Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

HTML to PDF conversion broken in 10.1.0

$
0
0
I was happy to see that the PDFNEWNET-37636 issue was fixed in the latest release of Aspose.Pdf for .NET (10.1.0).
Unfortunately the HTML to PDF conversion seems to be broken in this new version.

With the previous version of Aspose.Pdf for .NET, the following code produces a PDF file with 5 pages with a header on each page.

With the 10.1.0 version of Aspose.Pdf for .NET, only the 2 first pages comes out as expected, page 3 and forward are all blank(!)


String html = "";
html += "<!DOCTYPE html><html xmlns='http://www.w3.org/1999/xhtml'>";
html += "<head><style>";
html += ".page { width: 210mm; height: 297mm; margin: 0; padding: 0; }";
html += "</style><title></title></head><body>";
html += "<div class='page'><h1>PAGE 1</h1></div>";
html += "<div class='page'><h1>PAGE 2</h1></div>";
html += "<div class='page'><h1>PAGE 3</h1></div>";
html += "<div class='page'><h1>PAGE 4</h1></div>";
html += "<div class='page'><h1>PAGE 5</h1></div>";
html += "</body></html>";

HtmlLoadOptions options = new HtmlLoadOptions();
options.PageInfo.Margin.Top = 0;
options.PageInfo.Margin.Right = 0;
options.PageInfo.Margin.Bottom = 0;
options.PageInfo.Margin.Left = 0;
options.PageInfo.IsLandscape = false;
options.PageInfo.Width = Aspose.Pdf.PageSize.A4.Width;
options.PageInfo.Height = Aspose.Pdf.PageSize.A4.Height;
Document doc = new Document(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(html)), options);
doc.Save("c:/TEMP/test.pdf");


Any suggestions on a work-around to fix this issue would be most welcome since we really want to upgrade to get rid of that html-character bug.



Viewing all articles
Browse latest Browse all 3131

Trending Articles