Hi.
I’m having a problem when converting an HTML to PDF. I’ve attached both files.
My problem is: the left margin seems too big. What can I do to make it smaller? I’ve tried but I see no change.
Follows my Java code:
// get the source input
Document srcDoc = new Document(input);
srcDoc.save(output);
What do you suggest?
Kind regards,
JP.
Hi Renato,
Thanks for your inquiry. I have managed to reproduce the same issue at my side. I have logged this issue as WORDSNET-8844 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.
As a workaround, please use the following code snippet. Hope this helps you. Please let us know if you have any more queries.
Document doc = new Document(MyDir + "in.html");
for (Section section: (Iterable <Section> ) doc.getSections())
{
section.getPageSetup().setLeftMargin(72);
}
doc.save(MyDir + "out.pdf");
Hi Renato,
Thanks for your patience.
rparletta:
What can I do to make it smaller? I’ve tried
I have received response from our development team about WORDSNET-8772 and like to share with you that currently, only the following HTML construction is recognized by HTML import to set page margins (document contents are enclosed in a
element; page margins are specified inside @page rule). Please modify your html as shown below to set page margins. I have modified your input html and attached it with this post for your kind reference.
<html>
<head>
<style type="text/css">
@page mainpage {
/* Page margins are set here. */
margin - top: 0.5 in;
margin - right: 0.25 in;
margin - bottom: 0.50 in;
margin - left: 0.25 in;
}
div.pagesetup {
page: mainpage;
}
</style>
</head>
<body>
<div class="pagesetup">
<p>Text</p>
</div>
</body>
</html>