HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › HTML/CSS rendering issues › Question about header areaHeight
- This topic has 2 replies, 2 voices, and was last updated May 16, 2012
00:28:36 byAnonymous.
-
AuthorPosts
-
May 15, 2012 at 11:37#26726
Dear supporter,
I have a question about header height issue.
Here is my code
<br /> PD4PageMark header = new PD4PageMark();<br /> <br /> // date time..<br /> Date today = new Date();<br /> SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");<br /> <br /> header.setAreaHeight(15);<br /> //header.setPagesToSkip(2);<br /> header.setTitleTemplate(" "+formatter.format(today)+" ");<br /> header.setTitleAlignment(PD4PageMark.RIGHT_ALIGN);<br /> header.setFontSize(10);<br /> <br /> ImageIcon logo = new ImageIcon(_logoPath);<br /> int logo_width = logo.getIconWidth();<br /> int logo_height = logo.getIconHeight();<br /> <br /> header.setWatermark("file:"+_logoPath,new Rectangle(10,15,logo_width,logo_height), 100);<br /> <br /> _pdf.setPageHeader(header);<br /> <br /> PD4PageMark footer = new PD4PageMark();<br /> footer.setAreaHeight(20);<br /> footer.setPageNumberTemplate("$[page] / $[total]");<br /> footer.setPageNumberAlignment(PD4PageMark.CENTER_ALIGN);<br /> footer.setInitialPageNumber(1);<br /> footer.setPagesToSkip(0);<br /> footer.setFontSize(10);<br /> <br /> ImageIcon watermark = new ImageIcon(_watermarkPath);<br /> int watermark_width = watermark.getIconWidth();<br /> int watermark_height = watermark.getIconHeight();<br /> <br /> footer.setWatermark("file:"+_watermarkPath,new Rectangle(_width/2-(watermark_width/2),_height/2-(watermark_height/2),watermark_width,watermark_height), 30);<br /> <br /> _pdf.setPageFooter(footer);<br />
<br /> PD4PageMark header = new PD4PageMark();<br /> <br /> // date time..<br /> Date today = new Date();<br /> SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");<br /> <br /> header.setAreaHeight(15);<br /> //header.setPagesToSkip(2);<br /> header.setTitleTemplate(" "+formatter.format(today)+" ");<br /> header.setTitleAlignment(PD4PageMark.RIGHT_ALIGN);<br /> header.setFontSize(10);<br /> <br /> ImageIcon logo = new ImageIcon(_logoPath);<br /> int logo_width = logo.getIconWidth();<br /> int logo_height = logo.getIconHeight();<br /> <br /> header.setWatermark("file:"+_logoPath,new Rectangle(10,15,logo_width,logo_height), 100);<br /> <br /> _pdf.setPageHeader(header);<br /> <br /> PD4PageMark footer = new PD4PageMark();<br /> footer.setAreaHeight(20);<br /> footer.setPageNumberTemplate("$[page] / $[total]");<br /> footer.setPageNumberAlignment(PD4PageMark.CENTER_ALIGN);<br /> footer.setInitialPageNumber(1);<br /> footer.setPagesToSkip(0);<br /> footer.setFontSize(10);<br /> <br /> ImageIcon watermark = new ImageIcon(_watermarkPath);<br /> int watermark_width = watermark.getIconWidth();<br /> int watermark_height = watermark.getIconHeight();<br /> <br /> footer.setWatermark("file:"+_watermarkPath,new Rectangle(_width/2-(watermark_width/2),_height/2-(watermark_height/2),watermark_width,watermark_height), 30);<br /> <br /> _pdf.setPageFooter(footer);<br />My question is when i set header height first page and other pages have different height. This is same situation in PD4ML html_header example.
Any way to have same header height overall pages?
Kind regards,
GabrielMay 15, 2012 at 11:46#29001Most probably the first page header height difference effect is caused by the top margin. Try to define:
BODY { margin-top: 0; margin-bottom: 0 }
May 16, 2012 at 00:28 -
AuthorPosts
The forum ‘HTML/CSS rendering issues’ is closed to new topics and replies.