## MedplumClient.createPdf() method [​](/content/docs/sdk/core.medplumclient.createpdf#medplumclientcreatepdf-method "Direct link to MedplumClient.createPdf(/index.html) 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:**

```typescript
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](/content/docs/sdk/core.createpdfoptions) | The PDF creation options. See `CreatePdfOptions` for full details. |
| requestOptions | [MedplumRequestOptions](/content/docs/sdk/core.medplumrequestoptions) | _(Optional)_ Optional fetch options. |

**Returns:**

Promise< [WithId](/content/docs/sdk/core.withid) <Binary>>

The result of the create operation.

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

Example:

```typescript
const result = await medplum.createPdf({

content: ['Hello world']

});

console.log(result.id);
```

See the [pdfmake document definition](https://pdfmake.github.io/docs/0.1/document-definition-object/) for full details.

- [MedplumClient.createPdf() method](/content/docs/sdk/core.medplumclient.createpdf#medplumclientcreatepdf-method/index.html)
- [Parameters](/content/docs/sdk/core.medplumclient.createpdf#parameters/index.html)
- [Example](/content/docs/sdk/core.medplumclient.createpdf#example/index.html)
