I've got an issue where I have to generate pdf using pd4ml tool. It works fine for all the pages except the first page.
I've used the following lines of code.
Page2 and Page3 are working fine without any issues. But the first page doesn't accept the htmlwidth="1335"(rather it takes 640 which is default value).
Note: This works fine with pd4ml.jar in windows. Issue comes when the pdf generated using linux server.
Any help would be much appreciated.
<!DOCTYPE html>
<html>
<head>
<title>TITLE</title>
<style type="text/css" media="all">
* {margin: 0;padding: 0;}
body{margin:0;padding:0;font-family:Arial,Helvetica,sans-serif;color:#333;width: 1335px;}
table{border:0; border-spacing:0;width: 100%;}
table td{vertical-align: top;-webkit-text-size-adjust: none;}
img{border: 0;page-break-inside: avoid;}
</style>
</head>
<body>
<pd4ml:page.footer>
footer text goes here
</pd4ml:page.footer>
<pd4ml:page.header>
header text goes here
</pd4ml:page.header>
<div class="container" style="margin: 0;">
<pd4ml:page.break htmlwidth="1335"/>
Page 1 content
</pd4ml:page.break>
</div>
<div class="container" style="margin: 0;">
<pd4ml:page.break htmlwidth="1335"/>
page 2 content
</pd4ml:page.break>
</div>
<div class="container" style="margin: 0;">
<pd4ml:page.break htmlwidth="1335"/>
page 3 content
</pd4ml:page.break>
</div>
</body>
</html>
</pd4ml:transform>
You can define htmlWidth for the entire document (including the first page) with pd4ml.setHtmlWidth() API call.
<pd4ml:page.break htmlwidth="1335"/>
impacts htmlWidth of subsequent pages only. So with a page break directive it is not possible to define htmlWidth for the first page.
(Answer found here.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With