Skip to main content
gautams4173
December 8, 2025
Solved

Creating a dynamic pdf letterhead

  • December 8, 2025
  • 9 replies
  • 0 views

Hi folks,

As part of our requirement, we need to generate a letterhead in PDF format. The PDF should include the following:

  1. Header with the company logo and details — essentially two images:
    • Left: address & UEN
    • Right: company logo

  2. Standard document content with some dynamic fields (e.g., name, email address, reference numbers).

  3. A data table containing business information. The number of rows is dynamic (i.e., the table may have 1, 2, or n rows).

I’ve been exploring smart services that can generate a PDF with all these elements — images (for the header), dynamic text fields, and dynamic table rows. From my research, these two smart services from the Dynamic Document Generator Plug-in seem relevant:

  1. HTML to PDF

  2. XSL-FO to PDF

However, from what I understand, HTML to PDF may not fully support images (I’m not entirely sure, this seems to be a gray area). And I’m not very familiar with how to use XSL-FO for this type of transformation.

It would be really helpful if anyone could share documentation, examples, or best practices for using these smart services, especially around structuring the XML, building the XSL, and handling dynamic tables and images.

Any guidance would be greatly appreciated!

Thanks!

Best answer by shubhama926776

Use HTML to PDF smart service:
Images work - Use base64-encoded images or Urls
Build HTML string with:
Header: <img src="data:image/png;base64,YOUR_BASE64"> for logos
Body: Dynamic text fields
Table: Loop through data to generate <tr> rows
Pass HTML string to smart service

XSL-FO is overkill for this : stick with HTML.

9 replies

shubhama926776
December 8, 2025

Use HTML to PDF smart service:
Images work - Use base64-encoded images or Urls
Build HTML string with:
Header: <img src="data:image/png;base64,YOUR_BASE64"> for logos
Body: Dynamic text fields
Table: Loop through data to generate <tr> rows
Pass HTML string to smart service

XSL-FO is overkill for this : stick with HTML.

gautams4173
December 9, 2025

Hey [mention:9861aef97eb2483a8b76175d9eda1e37:e9ed411860ed4f2ba0265705b8793d05] 

Thanks for the response

Sure let me try the base64 way if it works 

shubhama926776
December 10, 2025

Let us know if that works for you..

harshas2775
December 9, 2025

You can use smart service "DOCX From Dynamic Template" to generate the DOCX with formatting and logos in the template itself. Data can be populated based on the XML you pass. For the Word Template you can refer the attached image below to get an idea about how you can create a template.

 

Later if you want to create a PDF you can use smart service "PDF from DOCX".

gautams4173
December 10, 2025

Hey [mention:65b14048184a4eb5aff3a76c87b97431:e9ed411860ed4f2ba0265705b8793d05] 

Thanks for response 

But this DOCX From Dynamic Template does not support dynamic table rows since we need to decide the table before hand. My requirement is to have dynamic rows i.e. 1/2/ n rows in a table based of my data

harshas2775
December 12, 2025

Actually Using the mergefield having loop definition in doc file we can pass n number of rows in the doc file dynamically! Row count is not fixed this way and very well formatted/dynamic. 

stefanhelzle0001
December 10, 2025
gautams4173
December 10, 2025

Amazing, thanks [emoticon:915ad1d08e5142b1a7b20a34b9246a61]