Saving PDF attachment using PDF Report Package

Hello,

According to the documentation here,

I can save the pdf file by calling the following methods:

Here is the button for generating a pdf
image
And here is my function for downloading and saving a pdf

It seems whenever I call downloadPdf, it’s not even logging the data inside the compiledData function, which makes me think it isn’t being called at all.

Do I have this set up right or am I missing something?

Thanks,

Alex

Hi @alex.dang ,

I see that you have a value in your htmlElements array that is called 'page-1':

const options = {
    fileName: 'test.pdf', // User specified name of the file
    pageOrientation: 'portrait', // landscape | portrait
    platform: 'windows', // Specify the platform used by the the app user: windows, android or ios
    htmlElements: ['page-1'], // Specify the ids of the pages in the template.handlebars file to be included in this file export
};

Could you please confirm if you have a page in your template.handlebars file with id="page-1"?

If you do not have a page with that id, please make sure to add the id so the function would know which pages to compile:

Please let us know if this solves the issue for you.

Thank you! This is exactly what was the issue.