March 4, 2020 at 16:08#33883
In the pdf we generate we are using an different header & footer on the first page, and on the other pages is also an header & footer visible. This was something that couldn’t be set-up by using the scope option, so for pd4ml v3 I followed an tip to extend the PD4PageMark (https://pd4ml.com/support/html-pdf-faq-f1/pdf-page-headers-footers-definition-options-t41-20.html)
and override the method getHtmlTemplate to return the correct html for that page.
Now with the new v4.0.7 API I can no longer override the PD4PageMark. As an alternative I tried it with the scope, but I get to see the header twice, so that’s not an option (see Code).
lPd4ml.setPageHeader( Html2, -1, "2+"); lPd4ml.setPageHeader( Html1, -1, "1");
PS For people who are wanting to use the same trick, in pd4ml v3 the calculation for the dynamic height off the header is based on the first header. If your second header is larger is would be cutt off. To fix this in our case, I added some empty line in the first header to make sure the size is equal.March 4, 2020 at 16:48#33885
In PD4ML v4 setPageHeader(html, …) method injects a portion of the HTML code, enclosed to
, right after opening tag. The strange behavior (the header printed twice) can only be theoretically explained if the header HTML is not well-formed or misbalanced and somehow as result merges both definitions. However it is difficult to imagine how the code should look like to achieve the effect. Could you please publish what is in Html2 and Html1 variables?March 5, 2020 at 10:41#33886
I checked and the reason it doesn’t work with us, is due to our use of html/header/body tags in the header.
If I remove those it is shown on the correct pages. I will check if this got any consequences in our resulting pdf.
Html1 = “<html><body>Header for only the First page
Html2 = “<html><body>Header for all pages, except the first
PS: I made 3 topics Yesterday and this is the only one I can find. My other topics where in licenses that the link to de site license isn’t correct, and then in technical that the resourceprovider isn’t working with the old API.
Do I have to recreate those or are they somewhere else ?March 5, 2020 at 10:43#33887
I forgot to put the html in a code block:
lHtml1 = "<html><body><div style=\"font-weight:bold\">Header for only the First page</div></body></html>"; lHtml2 = "<html><body><div style=\"font-weight:bold\">Header for all pages, except the first</div></body></html>";
You must be logged in to reply to this topic.