Please give a brief summary of your issue:
Hello i am in the process of building out a PDF engine for our reporting platform with a set of basic HTML templates that clients can choose and then use in their reports. It seems that nearly all the HTML or CSS i try to use doesn’t behave or render correctly. I am using as basic of HTML and CSS as you can do and still things are not working. I have been through the documentation for the module numerous times but unfortunately there is not too much in terms of documentation or example on the current site which hopefully we can address over time for other clients as well.
There are a few things I am trying to accomplish:
Custom headers and footers for clients that include their image and brand colors. I am trying to use flex box and background colors to accomplish this very simple layout and it works in js fiddle but returns nothing but plain text when i use the module.setHeader(custom_html_code) or module.setFooter(custom_html_code) . It ignore any css i throw at it besides font color and size. And i haven’t found any documentation that says one way or another what it supports.
This is a header iam trying to achieve and it seems impossible at the moment via setHeader().
Tables
I noticed that it does not like when I use the or HTML tags, and if i add with cell padding of 4px i get weird table row overhang. Can you not use pixel based padding?
The following CSS properties don’t seem to work to achieve the repeating header and footer rows across pages: display: table-header-group;display: table-footer-group;
General layout questions:
I am trying to make 2 column / 4 quadrant kind of layouts using Flexbox and css grid and they don’t seem to work 100% correctly. Especially when some items such as charts are given an exact height. Is setting exact heights prohibited in this module?
When did this start occurring? What changed at that time?
Just downloaded and started a fresh NodeJS project based on the sample get started stuff. So from the very beginning I have had this issue.
Please provide full error message, stack trace, and any related logs.
I am not getting an error messages, technically the PDF is rendering successfully it just doesn’t seem to be honoring valid html or CSS, is there documentation on this module that explains what all you can do?
Are you able to reproduce the issue using one of the sample projects in our SDK?
const { PDFNet } = require(‘@pdftron/pdfnet-node’);
const PDFTronLicense = require(‘…/LicenseKey/LicenseKey’);
Or does this only occur in your own project? If so, we would need access, or related code snippets.
Looks to occur on all projects.
Is the issue specific to a certain file? If so, we would need that file to diagnose further.
Doesnt seem to be isolated, across the board i get the same issue rendering.
Does the issue occur, or not occur, on certain devices? If so please provide details.
It occurs on both Mac and iwndows modules of HTML2PDF that i have tried so far. I dont have a linux machine to confirm that OS.
What version of our SDK are you using?
The latest version 10.4.0 of @pdftron/pdfnet-node
@Ryan - Thanks for sharing this, do you have any examples of how to add background colors or basic css to this header? OR have a way via Apryse to not use this setHeader and instead make a custom div that repeats on every page? Really just looking for any example code you may have cause I’m struggling to find any decent documentation regarding support.
If the Chromium header/footer option is not enough for you, you could instead leave the header/footer blank, and post process the PDF file afterwards.
For instance you could use our Stamper class to fill in the header/footer blank margin area.
Furthermore, you could use the HTML2PDF module to convert your header/footer to PDF separately, and then use Stamper.StampPage to stamp that to original PDF from HTML2PDF module. See this forum post for more about this route.