Hi I am using the code from the examples to generate the PDF (my ultimete goal is to allow the patient / practitioner to upload the documents / certificates)
here is the code:
import { BotEvent, MedplumClient } from '@medplum/core';
export async function handler(medplum: MedplumClient, event: BotEvent): Promise
{
// Create the PDF
const binary = await medplum.createPdf({
content: ['Hello world'],
});
console.log('Binary result', binary);
// Create a Media, representing an attachment
const media = await medplum.createResource({
resourceType: 'Media',
content: {
contentType: 'application/pdf',
url: 'Binary/' + binary.id,
title: 'report.pdf',
},
status: 'in-progress'
});
console.log('Media result', media);
}
execute bot cause the exception - Unhandled error: {} Error PDF creation not enabled.
I've found in the core medplum code, but I am not sure what to do to cause my bot impementation to work properly.
https://github.com/medplum/medplum/blob/main/packages/core/src/client.ts#L264
Please help me with the steps to resolve the exception to allow me to create and upload PDF
Thanks.
I just wanted to add more info after my research:
I can't find any good example similar to a problem I am facing. also it is not clear how to implement it - meaning bot entry point is signature is:
export async function handler(medplum: MedplumClient, event: BotEvent): Promise
and MedplumClient been initialized before , right? so what is the way to provide the createPdf implementation? I also walked thru the server code but I can't find the place where to initialize it. also it looks a quite complicated to change the server code and recompile it for writing a Bot, so i think my research brings me to the wrong direction.
@reshma @rahul1 , can you please pointing me how to resolve the problem