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

Free Support Forum - aspose.com

Convert HTML to PDF using Aspose.PDF for .NET - The result PDF is different than HTML

Hi,
I can see some differences between generated PDF and source HTML files.

The code used to generate PDF from HTML:

        string source = @"test.html";

        Aspose.Pdf.HtmlLoadOptions htmloptions = new  Aspose.Pdf.HtmlLoadOptions(Environment.CurrentDirectory + @"\");
        htmloptions.PageInfo.Margin.Top = (float)10;
        htmloptions.PageInfo.Margin.Bottom = (float)10;
        htmloptions.PageInfo.Margin.Left = (float)10;
        htmloptions.PageInfo.Margin.Right = (float)10;

        Aspose.Pdf.Document doc = new Aspose.Pdf.Document(source, htmloptions);

        doc.Save(@"test.pdf");

I’ve highlighted differences in the image below:
difference.png (141.2 KB)

Also, including HTML file with css and JS files:
HTML.zip (5.1 KB)

Difference 1:
I want to inform you, when I remove language attribute from the line below, it start to render the missing text, but as I understand, pdf should be exact copy of what we see in the browser, if so, please give me more information on why this code does not work with Aspose but works in all browsers.

< script language=“JavaScript1.2”>getBarCde(); </ script >

Difference 2:
I have no idea why this happens. :slight_smile:

@armanveranyan

We were able to replicate the similar issue in our environment while testing the scenario with Aspose.PDF for .NET 20.4. We have logged it as PDFNET-48103 in our issue tracking system for correction and will keep you posted with the status of its resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hello,

Thanks for response.