core.medplumclient.createpdf
Home > @medplum/core > MedplumClient > createPdf
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<Binary>;
Parameters
Parameter  | Type  | Description  | 
|---|---|---|
createPdfOptions  | The PDF creation options. See   | |
requestOptions  | (Optional) Optional fetch options.  | 
Returns:
Promise<Binary>
The result of the create operation.
Example
Example:
const result = await medplum.createPdf({
  content: ['Hello world']
});
console.log(result.id);
See the pdfmake document definition for full details: https://pdfmake.github.io/docs/0.1/document-definition-object/