7
Views
1
Comments
[HTML2PDF] Best approach to generate PDF from AI-generated HTML and store as Binary in database
html2pdf
Service icon
Forge asset by Miguel Antunes
Application Type
Reactive

Hi everyone,

I'm building an audit report generation feature in OutSystems 11 using an AI agent (hosted in ODC) that returns a formatted HTML string. The flow works like this:

  1. User clicks "Generate Report" on the audit screen
  2. O11 calls an ODC REST API
  3. The ODC agent (OpenAI) generates a structured HTML audit report
  4. The HTML is returned to O11

My current approach uses HTMLString2PDF (HTML2PDF Forge component) as a Client Action to convert the HTML and download the PDF directly in the browser. This works fine for downloading, but since it runs client-side it doesn't return Binary Data, so I can't store the PDF in the database.

The problem: Every time the user clicks the button, a new call is made to the AI agent, which may return a slightly different report. I need to generate the PDF once, store it in the database, and always serve the same file on subsequent downloads.

What I need: A server-side solution that:

  • Takes an HTML string as input
  • Returns Binary Data (PDF)
  • Works reliably on OutSystems 11 (cloud or on-premises)

We have already tested some server-side components from Forge but ran into issues with both of them:

  • HTML2PDF_Converter — timed out, likely due to wkhtmltopdf binaries not being installed or blocked by firewall
  • PDF (GeneratePDF action) — also failed with a hostname parsing error on the server

Has anyone solved this pattern? What's the recommended approach for server-side HTML-to-PDF generation in O11 that returns Binary Data?

Thanks in advance!

2025-12-29 12-54-39
Muhammad Shehroz Ali

Hi Leonel, have you tried this action, as it takes url or html as input and returns PDFBinary. If this is not useful then try UltimatePDF

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