We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Converting HTML to PDF. Large free space at left and top

I'm working on conversion from HTML to PDF and it's work. But the layout is not match the HTML layout.
The PDF always keep large free space at top and left.
I tried to set left and top margins and padding of the pages to 0, but there's no effect.
Can you give me the solution how to set the padding for generated PDF?

Hi there,

Thanks for your inquiry. You may set PageInfo object of HtmlLoadOptions for setting output PDF page size, please check following code snippet, it will help you to accomplish the task. If the issue persist then please share your sample HTML document here, we will look into it and guide you accordingly.

HtmlLoadOptions loadOptions = new HtmlLoadOptions();<o:p></o:p>

// set the PageInfo,in Aspose.Pdf 1 inch = 72 points

loadOptions.PageInfo.Margin.Bottom = 10;

loadOptions.PageInfo.Margin.Top = 20;

loadOptions.PageInfo.Width = 600;


//Load HTML string

Document doc = new Document("input.html", loadOptions);



Best Regards,