core.medplumclient.createpdf | Medplum

MedplumClient.createPdf() method

Creates a PDF as a FHIR Binary resource based on pdfmake document definition.

The return value is the newly created resource, including the ID and meta.

The docDefinition parameter is a pdfmake document definition.

Signature:

createPdf(createPdfOptions: CreatePdfOptions, requestOptions?: MedplumRequestOptions): Promise<WithId<Binary>>;

Parameters [​](/content/docs/sdk/core.medplumclient.createpdf#parameters "Direct link to Parameters"/index.html)

Parameter Type Description
createPdfOptions CreatePdfOptions The PDF creation options. See CreatePdfOptions for full details.
requestOptions MedplumRequestOptions (Optional) Optional fetch options.

Returns:

Promise< WithId >

The result of the create operation.

Example [​](/content/docs/sdk/core.medplumclient.createpdf#example "Direct link to Example"/index.html)

Example:

const result = await medplum.createPdf({

content: ['Hello world']

});

console.log(result.id);

See the pdfmake document definition for full details.