How is your experience with the OutSystems Community?
22
Views
9
Comments
How to convert a Local List to PDF and then Base64 in OutSystems?
Question

Hi Everyone,

I am receiving a Local List from one block.

 My requirement is: Convert the Local List table data into a PDF document. 

I Convert the generated PDF binary into a Base64 string. I tried using HTML2PDF by generating HTML from the list data and passing the HTML to the PDF generation action. However, the PDF generation is failing and returns a 0-byte PDF with the following error - "Cannot call a class as a function"


JS is attached


Thank you,

Nihil

JSCode.txt
2026-01-28 16-57-48
Mihai Melencu
Champion

Hi @Nihil Gujar ,

Can you link the exact component you are using? There are multiple "HTML2PDF" component in the forge.

I tried your approach with this component, and it worked: https://www.outsystems.com/forge/component-overview/10546/html2pdf-o11 .

Try using that one.

2022-12-05 07-28-20
Nihil Gujar

Hello, 

Can you please add oml for reference purpose?

2026-01-28 16-57-48
Mihai Melencu
Champion

Hi,

You can see the implementation in this OML. It fetches the Users, then appends them to a local list, and I created an action like yours.

SampleHTML.oml
2022-12-05 07-28-20
Nihil Gujar

Hi @Mihai Melencu , 

I tried your application but this one also returns me 0 bytes, can you please confirm version of HTML2PDF.

My versions:

HTML2PDF - 2.0.2

HTML2PDF_ext - 2.0.1

2026-01-28 16-57-48
Mihai Melencu
Champion

I have the same versions. Can you share your OML with the implementation?

2022-12-05 07-28-20
Nihil Gujar

I’m unable to share my organization’s OML due to restrictions. However, I only made a minor change to your application by adding one additional action.

SampleHTML_new.oml
2026-01-28 16-57-48
Mihai Melencu
Champion

Hi,

Your new module had dependencies on some of your other modules. Since I don’t have access to them, I created my own Employee structure to match the format expected by your JavaScript. I also created a wrapper action that generates the PDF and converts it to Base64.


Seems to be working fine:

Please test on your side and let me know if it's working.

SampleHTML_updated.oml
2022-12-05 07-28-20
Nihil Gujar

I am getting this error message from Generate Pdf - "Problem generating PDF from HTML, URLs: -, outputFilename: C:\Users\OutSystemsApplications\AppData\Local\Temp\.local-HtmlToPdfConverter\7a0c56c1-7323-478a-9419-795dea2a6fb7.pdf"

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.