HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML Forums › Technical questions / Troubleshooting › Incorrect page number alignment $[page]
- This topic has 3 replies, 2 voices, and was last updated Jun 16, 2023
12:13:59 by U. Sponholz.
-
AuthorPosts
-
June 13, 2023 at 13:01June 13, 2023 at 13:05#36610
Wenn im
<style>
Bereich eine Formatierung mit<%@ taglib uri=”/WEB-INF/tlds/pd4tl.tld” prefix=”pd4tl”%><pd4tl:transform
screenWidth=”800″
pageFormat=”A4″
pageOrientation=”portrait”
pageInsets=”20,10,10,10,mm”>
<pd4tl:header
titleTemplate=”$[title]”
titleAlignment=”left”
pageNumberTemplate=”Seite $[page] / $[total]”
pageNumberAlignment=”right”
/>
<html>
<head>
<title>Gefüllte Auberginenröllchen mit Tomaten-Paprika Ragout</title>
<style type=”text/css”>
td {
text-align: left;
}
</style>
</head>
<body style=”background-color: lightgray;”>
<p>
Hello, World!
</p>
</body>
</html>
</pd4tl:transform>Attachments:
You must be logged in to view attached files.June 14, 2023 at 15:39#36618The
pageNumberTemplate
andpageNumberAlignment
attributes in the code<pd4tl:header titleTemplate=”$[title]” titleAlignment=”left” pageNumberTemplate=”Seite $[page] / $[total]” pageNumberAlignment=”right” />
are supported for backward compatibility with text-only headers/footers of PD4ML v3. They are converted into HTML table with the simple code:
style += "font-size: " + fontSize + "px; "; tpl = "<table width=100% border=0 style=\"" + style + "\">\n<tr>\n<td width=33% style=\"" + style + "\">" + left + "</td><td align=center width=33% style=\"" + style + "\">" + center + "</td><td width=34% align=right style=\"" + style + "\">" + right + "</td>\n</tr>\n</table>";
and obviously affected by
TD
styleThe best approach would be to use your header markup, not relying on v3 legacy and the auto-generated three column table
<pd4ml:page.header> ... HTML ... ”$[title]” ... HTML ... Seite $[page] / $[total] ... </pd4ml:page.header>
But if you need to provide a compatibility to older HTML/JSP templates, you can add the explicit style:
pd4ml-page-header TD {text-align: right;}
And of course, we’ll try to resolve the issue with an ignoring of
pageNumberAlignment=”right”
June 16, 2023 at 12:13#36624Thank you very much for the useful information!
Through your presentation of the internals I was able to solve another problem, that I had when I switched from V3 to V4: particularly long titles in the headline were wrapped. So I modified one of your variants for a short-term solution:pd4ml-page-header TD:nth-child(1) {
white-space: nowrap;
}
pd4ml-page-header TD:nth-child(3) {
width: 10%;
white-space: nowrap;
text-align: right;
}In the long term, I will gradually change the templates to
<pd4ml:page.header>
. -
AuthorPosts
You must be logged in to reply to this topic.