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
-
June 2, 2009 at 11:15#26201
PD4ML provides 3 types of headers/footers.
- text-only
- html (PD4ML Pro)
- inline (PD4ML Pro)
The first 2 options are available by PD4ML Java API calls (or as JSP custom tags mapped to PD4ML API): i.e.
<pd4ml:footer>-> pd4ml.setPageFooter();1. Text only (in such form can be used only in JSP):
<pd4ml:footer pageNumberTemplate="page $[page] of $[total]" titleAlignment="left" pageNumberAlignment="right" color="#008000" initialPageNumber="1" pagesToSkip="1" fontSize="14" areaHeight="18"/>
Java version:
PD4PageMark footer = new PD4PageMark(); footer.setPageNumberTemplate("page $[page] of $[total]"); footer.setTitleAlignment(PD4PageMark.LEFT_ALIGN); footer.setPageNumberAlignment(PD4PageMark.RIGHT_ALIGN); footer.setColor(new Color(0x008000)); footer.setInitialPageNumber(1); footer.setPagesToSkip(1); footer.setFontSize(14); footer.setAreaHeight(18); pd4ml.setPageFooter(footer);2. HTML formatted footer (in such form can be used only in JSP)
<pd4ml:footer areaHeight="-1"> <font color="red"><i>page $[page] of $[total]</i></font> </pd4ml:footer>
Java version:
PD4PageMark footer = new PD4PageMark(); footer.setHtmlTemplate("<font color="red"><i>page $[page] of $[total]</i></font>"); footer.setAreaHeight(-1); pd4ml.setPageFooter(footer);areaHeight=”-1″ means “autocompute” there
3. The third option, inline footer, allows to define footer body in HTML/PHP document:
<pd4ml:page.footer> footer: $[page] of $[total] </pd4ml:page.footer>
The definition impacts all subsequent pages after the page, where the footer defined. A new appearance of the footer overrides previously defined one.
In order to define the footer for the first page, you need to place the definition immediately after<body>tag or before<html>.Also you may explicitly define pages, where the footer needs to be applied:
<pd4ml:page.footer scope="1"> first page footer: $[page] of $[total]<br> <img src="img1.gif"> </pd4ml:page.footer> <pd4ml:page.footer scope="2+"> footer: $[page] of $[total]<br> <img src="img2.gif"> </pd4ml:page.footer> <html> <head> ...
The above defines different footers for the first page and for the rest of the pages (the second and others). Also “scope” understands “even”, “odd” and “skiplast” modifiers. Example:scope=”2,5-10,even,skiplast”
November 8, 2009 at 10:45#27266I’m evaluating your product to use in production at a customer site.
I tried to add headers and footers to pages with these definitions:<pd4ml:page.header> <table> <tr> <td> <img src="images/logos/telco/TLCO_headerOff.JPG"> </td> </tr> </table> </pd4ml:page.header> <pd4ml:page.footer> <table> <tr> <td> <img src="images/logos/telco/TLCO_footerOff.JPG"> </td> </tr> </table> </pd4ml:page.footer>
The header appears but the footer does not.
I’m using the latest version of the library (3.5.1). I already checked the images and verified they are correct.
Can you help me?November 11, 2009 at 11:55#27267First, try to make sure that it tries to render the footer: add border=”1″ to footer’s
<table>and ispect if the borders are in the PDF output.November 13, 2009 at 10:57#27268I tried adding border=”1″ to the table element. The footer does not print. What else can I do?
November 13, 2009 at 11:05#27269How many pages has the resulting PDF document?
Does it print the footer on the second page?November 13, 2009 at 11:16#27270The document has tree pages. The header prints on every page correctly while the footer never prints.
Just in case, I can send you an example generated PDF and the HTML used.November 13, 2009 at 11:40#27271yes, please send it to support (at) pd4ml . com
August 24, 2011 at 08:39#27272Hello,
Did you find the solution for footer issue mentioned?I am also facing the same problem.August 24, 2011 at 15:09#27273Please send the HTML source, Java code snippet (if any) and its resulting PDF to support pd4ml com.
July 4, 2012 at 14:34#27274I’m trying to insert a footer for only page 1.
Via API-call this can’t be done, accordering to the reference.
So, only inline is the only option I see.
This is my code:
<pd4ml:page.footer scope="1" areaHeight="100"> <div style="position: relative; float:left; top: 10px; left: 590px; font-size: 16pt; font-weight: bold;">52008</div> <div style="position: relative; float:left; top: 10px; left: 850px; font-size: 16pt; font-weight: bold;">20090001</div> </pd4ml:page.footer> <html xmlns="http://www.w3.org/1999/xhtml"> <head>
…This part seems to be just ignorred. (page.header does work this way).
Is this a bug, or am I doing something wrong?
July 4, 2012 at 15:36#27275replace areaHeight=”100″ with height=”100″ – it should help if you use PD4ML Pro (not Std)
July 20, 2012 at 09:23#27276Thanks for you quick reply, this solution worked!
February 1, 2013 at 14:35#27277I’m trying to put header and footer put through java, how can I do this?
February 1, 2013 at 14:58#27278With PD4ML Pro it can be done like that:
PD4PageMark footer = new PD4PageMark(); footer.setHtmlTemplate("<font color="red"><i>page $[page] of $[total]</i></font>"); footer.setAreaHeight(-1); pd4ml.setPageFooter(footer);Use pd4ml.setPageHeader() for headers.
February 1, 2013 at 16:59#27279Hi Folks,
when I already tried this, but it no works.
When I put footer and header, only header appears.Thanks in advance.
-
AuthorPosts
The forum ‘General questions / FAQ’ is closed to new topics and replies.
