HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › General questions / FAQ › PDF page headers/footers definition options
- This topic has 32 replies, 6 voices, and was last updated Dec 04, 2017
06:30:48 byPD4ML.
-
AuthorPosts
-
February 1, 2013 at 17:02#27280
Which PD4ML version do you currently use? It can be checked in Document properties of any PDF, generated with the library.
February 1, 2013 at 17:19#27281I’m using the PRO version.
February 1, 2013 at 17:25#27282I’m trying to do somthing similar this:
PD4PageMark header= new PD4PageMark(); header.setHtmlTemplate("<font color="red"><i>page $[page] of $[total]</i></font>"); header.setAreaHeight(-1); pd4ml.setPageHeader(header); PD4PageMark footer = new PD4PageMark(); footer.setHtmlTemplate("<font color="red"><i>page $[page] of $[total]</i></font>"); footer.setAreaHeight(-1); pd4ml.setPageFooter(footer);But the pd4ml doesn’t render the footer.
February 4, 2013 at 11:25#27283Nobody can help me?
February 7, 2013 at 13:02February 7, 2013 at 13:04#27285Try to temporarily set the height parameter to any defined value:
footer.setAreaHeight(50);
Does it change anything?February 8, 2013 at 19:13#27286I need to use scope in headers’/footers’ settings thought java API.
After read PD4ML API reference and some samples, I noticed that there isn’t a method to set the scope attribute.
Is it possivel?February 8, 2013 at 19:24#27287I need to use scope in headers’ and footers’ settings by java API.
After read PD4ML API reference and some samples, I noticed that there isn’t a method to set the scope attribute.
Is it possivel?February 15, 2013 at 15:49#27288There is a number of header-definition methods:
https://pd4ml.com/cookbook/pdf_header_footer_generation.htmWith Java API you may either merge header definition like
<pd4ml:page.header scope="2+">with HTML content (the header definition needs to be before opening<html>tag) or to customize PD4PageMark instance;PD4PageMark header = new PD4PageMark() { public String getHtmlTemplate(int pageNumber) { if ( pageNumber > 1 ) { return "<html><body>some document header stuff..."; } else { return ""; } } }; pd4ml.setPageHeader(header);July 19, 2013 at 11:35#27289@PD4ML wrote:
I am using this code to display footer using java.It is showing me String of page number but image is not being attached.I want to attach image in footer.
PD4PageMark footer = new PD4PageMark(); footer.setHtmlTemplate("<font color="red"><i>page $[page] of $[total]</i></font><br> <img src="E:\HAT_FLASH.gif"> "); footer.setAreaHeight(-1); pd4ml.setPageFooter(footer);November 19, 2013 at 21:07#27292Hi
I am evaluating pd4ml. Do headers/footers work with the evaulation version? Here is my code:
File pdf = new File("/tmp/test.pdf"); PD4ML pd4ml = new PD4ML(); try (java.io.FileOutputStream fos = new java.io.FileOutputStream(pdf)) { { PD4PageMark header = new PD4PageMark(); header.setHtmlTemplate("<font color="red"><i>header $[page] of $[total]</i></font><br>"); header.setAreaHeight(50); pd4ml.setPageHeader(header); } { PD4PageMark footer = new PD4PageMark(); footer.setHtmlTemplate("<font color="red"><i>footer $[page] of $[total]</i></font><br>"); footer.setAreaHeight(50); pd4ml.setPageHeader(footer); } pd4ml.enableDebugInfo(); pd4ml.render(new StringReader("<html><body>BODY<pd4ml:page.break/>BODY2<pd4ml:page.break/>BODY3</body></html>"), fos); }This is the version: version: PD4ML 385 (eval)
The PDF doc has 3 pages, the evaluation version thing is there in the footer but nothing else appears in the header or the footer area. Can you please advise what I am doing wrong?
Thank you,
JozsefNovember 20, 2013 at 10:59#27293HTML header/footer templates are supported by PD4ML Pro (and derived volume licenses). As I see you evaluate PD4ML Std, which provides support for text-only header/footer.
See https://pd4ml.com/cookbook/pdf_header_footer_generation.htm
February 22, 2016 at 21:57#27290Okay that looks like a bigger problem then estimated.
I have the same issue too.
I generate a complete header and footer.
Footer:
<pd4ml:page.footer scope="1"> <div style="background-color:red;"> <p style="" class="" id=""><br><br><br><br><br><br><br><br><br><br><br><br><br> <table align="center"> <tbody> <tr> <td>Inhaber:</td> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td>Max Mustermann</td> <td>Straße 1</td> <td>Undso weiter</td> </tr> </tbody> </table> </div> </pd4ml:page.footer>
The footer is their (yeah) BUT! 🙁 I can only see Inhaber at the bottom of the page and also head footer is VERY high. I mean 1/2 of A4
On the other hand, the header is shown very accurate.
The complete html code here:
<pd4ml:page.header scope="1"> <div style="width:100%;background-color:yellow;"> <div> <img class="" id="" style="width:100mm;max-width:100mm;margin-left:10cm;" src="data:image/*;base64,...."> </div> </div> </pd4ml:page.header><pd4ml:page.footer scope="1"> <div style="background-color:red;"> <p style="" class="" id=""><br><br><br><br><br><br><br><br><br><br><br><br><br> <table align="center"> <tbody> <tr> <td>Inhaber:</td> <td></td> <td></td> <td></td> </tr> <tr> <td></td> <td>Max Mustermann</td> <td>Straße 1</td> <td>Undso weiter</td> </tr> </tbody> </table> </div> </pd4ml:page.footer><html> <head> <title>Footer</title> <style>.designChapter_1{}#chapter_-3343589119799051750{}.designChapter_1{}#chapter_-7878110909822710151{}</style> </head> <body> <div class="" style=""> <div class="" id="container_-6790600175644917974" style="width:10.5cm;margin-left:2cm;height:5mm;border:1px solid orange;font-size:7pt;"> <p style="" class="" id="">Intelligy Science UG | Am Neumarkt 30 | 22041 Hamburg </div> <div class="" id="container_-7299820427654925394" style="width:10.5cm;height:12.7mm;border:1px solid red;margin-left:2cm;float:left;"></div> <div class="" id="container_-5695738824325508680" style="width:10.5cm;margin-left:2cm;height:27.3mm;border:1px solid blue;float:left;font-size:10pt;"> <p style="" class="" id="">#kontaktFirma#<br>#kontaktVorname# #kontaktNachname#<br>#kontaktStraße# #kontaktHausnummer#<br><br>#kontaktPLZ# #kontaktOrt# </div> <div class="" id="container_-5799771009836692084" style="border:1px solid green;margin-left:12.5cm;margin-right:1cm;font-size:9pt;text-align:left;width:20cm;float:left;margin-top:-4cm;height:-1cm;"> <p style="" class="" id="">Intelligy Science<br>Straße<br>22041 Hamburg<br><br>Telefon: <br>Fax: <br><br>E-Mail: <br>Web: </div> <div class="" id="container_-109430433127867131" style="clear:both;"></div> <div class="" id="container_-4697751580106713612" style="width:7.5cm;margin-left:2cm;border:1px solid magenta;margin-top:2.5cm;height:3.5cm;"></div> <div class="" id="container_-8586357502960676866" style="width:12.5cm;border:1px solid yellow;margin-left:7.5cm;margin-top:2.5cm;height:3.5cm;"></div> </div> <div class="designChapter_1" style=""></div> <div class="designChapter_1" style=""></div> </body> </html>The version I am using is 3.9.8fx3 Pro
Any Idea?
February 22, 2016 at 22:03#27291Sorry I think I found MY mistake
November 29, 2017 at 03:38#27294Hai everyone, how to implement this java code below into cfscript?
PD4PageMark footer = new PD4PageMark() { public String getHtmlTemplate(int pageNumber) { if ( pageNumber % 2 == 0 ) { return "<html><body>some left aligned stuff..."; } else { return "<html><body>some right aligned stuff..."; } } }; pd4ml.setPageFooter(footer); -
AuthorPosts
The forum ‘General questions / FAQ’ is closed to new topics and replies.
