Skip to main content
Glama
create-pdf.ts1.03 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import type { BotEvent, MedplumClient } from '@medplum/core'; import type { DocumentReference } from '@medplum/fhirtypes'; export async function handler(medplum: MedplumClient, event: BotEvent): Promise<DocumentReference> { console.log(event); // Generate the PDF const binary = await medplum.createPdf({ docDefinition: { content: [ 'First paragraph', 'Another paragraph, this time a little bit longer to make sure, this line will be divided into at least two lines', ], }, }); // Create a Media, representing an attachment const documentReference = await medplum.createResource({ resourceType: 'DocumentReference', status: 'current', content: [ { attachment: { contentType: 'application/pdf', url: 'Binary/' + binary.id, title: 'report.pdf', }, }, ], }); return documentReference; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/medplum/medplum'

If you have feedback or need assistance with the MCP directory API, please join our Discord server