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

Free Support Forum - aspose.com

NullReferenceException coverting html to pdf

Hi,


I am using Aspose.pdf to convert html to Pdf (File version 11.4.0.0, Product version 2016.03.07).

When I use “page-break-before:always” in combination with “@page :first”, I get a NullReferenceException when I try to load the .html file.

My c# code:

HtmlLoadOptions hlo = new HtmlLoadOptions();
Document doc = new Document(“Form_3.html”, hlo);

My html:

body {
font-family: arial;
font-size: 13px;
margin-left: 10mm;
}
@page {
margin-bottom: 30mm;
}
@page :first {
margin-left: 20mm;
}
.newpage {
page-break-before: always;
}

HELLO.

BYE.

HELLO.



When I remove the @page :first it works fine.
I use the @page :first because the first page should have a different margin on the left.

Is this feature not supported?
Is there a way to avoid this?

Thanks.

Hi there,

Thanks for your inquiry. I have tested your scenario with @page rule and page-break-before style and managed to observe the reported exception. For further investigation, I have logged an issue in our issue tracking system as PDFNEWNET-40579 and also linked your request to it. We will keep you updated via this thread regarding the issue status.

We are sorry for the inconvenience caused.

Best Regards,