HTML to PDF - Huge margins on sides of file

I'm using Aspose.Pdf to convert an HTML file to a PDF file. However, I'm seeing huge discrepancies between how the two look - most notably, the left and right margins in the PDF come out as enormous, with all of the content squished into the middle third of the page. The code looks like this:

var pdfGenerator = new Aspose.Pdf.Generator.Pdf();
using (Stream htmlAsStream = File.OpenRead(document.FullPath))
{
pdfGenerator.BindHTML(htmlAsStream, string.Empty);
}
pdfGenerator.Save(pdfPath);

I've attached a .zip file containing the input HTML and the output PDF. I'm trying to figure out what it is about the file that makes it output so strangely, and if there's a way I can fix it.

I am using Aspose.Pdf version 10.1.0.0 and .NET 4.5.50938.

Hi Lucas,


Thanks for your inquiry. Please try DOM approach for HTML to PDF conversion, it is more improved and efficient. Please find attached output PDF. It is better than output of old generator. Hopefully it will help you to accomplish the requirement.

Best Regards,

Yup, that did the trick, thanks.

Hi Lucas,


Thanks for your feedback. It is good to know that your issue has been resolved with new DOM approach.

Please keep using our API and feel free to ask any question or concern, we will be more than happy to extend our support.

Best Regards,