I am trying to convert attached HTML file to PDF using Asponse’s(v9.0) Document.SaveToPdf method.
In the converted pdf, top and left margins are too big and I would like to know how to control these margin so that PDF generated looks same as HTML content.
Thanks,
Uday
Hi
Thanks for your inquiry. This occurs because HTML is one page document and this format is designed for Web and not for displaying on pages.
But you can try setting margins using the following code:
Document doc = new Document("in.htm");
doc.Sections[0].PageSetup.RightMargin = doc.Sections[0].PageSetup.RightMargin - 50;
doc.Sections[0].PageSetup.LeftMargin = doc.Sections[0].PageSetup.LeftMargin - 50;
doc.SaveToPdf("out.pdf");
Best regards,
Thanks for the quick reply.