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

Free Support Forum - aspose.com

Html to pdf- text missing

Hi,
We are using liscensed Aspose.pdf to generate pdf from html
The code we are using comes from your website as below
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
// add the section to PDF document sections collection
Aspose.Pdf.Generator.Section section = pdf.Sections.Add();

// Read the contents of HTML file into StreamReader object
StreamReader r = File.OpenText(@“D:/pdftest/HTML2pdf.html”);
//Create text paragraphs containing HTML text
Aspose.Pdf.Generator.Text text2 = new Aspose.Pdf.Generator.Text(section, r.ReadToEnd());
// enable the property to display HTML contents within their own formatting
text2.IsHtmlTagSupported = true;
//Add the text paragraphs containing HTML text to the section
section.Paragraphs.Add(text2);
// Specify the URL which serves as images database
pdf.HtmlInfo.ImgUrl = “D:/pdftest/MemoryStream/”;

//Save the pdf document
pdf.Save(“D:/pdftest/MemoryStream/HTML2pdf.pdf”);


However, the Right part of the pdf generated doesn’t show right, Check text are missing and layout is weird. I attached the original files(html and pdf generated) in the attachment. Please use them for testing and provide the solution if possible. It is very urgent. Thank you very much.




Hi Ying,

Thanks for using our products.

I have tested the scenario and I am able to reproduce the same problems that text is missing in resultant PDF and layout of PDF contents is not correct. For the sake of correction, I have logged it in our issue tracking system as PDFNEWNET-35873. We will investigate this issue in details and will keep you updated on the status of a correction.

We apologize for your inconvenience.

Hi, Shahzad

Thank you for replying. Is it possible to change the property of the pdf generated to correct this problem? Or is there any way you can recommend so that we can give a try?

It is very urgent because of the urgent delivery.

Thanks again.

Ying

Hi,


Want to give a update on our side. There are some empty table cell in our html with width style set up to fixed px, as long as we move those width setting , the pdf can be generated correctly but the original html will look a little bit different after we make these changes. Hope Aspose can take into those situation into consideration when convert html to pdf in the future.

Thanks.
Ying

Hi Ying,


Thanks for your feedback. We’ve shared your findings/suggestions with our development team, definitely we will consider these in issue resolution. We will keep you updated about the issue progress via this forum thread.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-35873) have been fixed in Aspose.Pdf for .NET 9.1.0.

For further details, you may check this blog post.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

HI Ying,

Thanks for your patience. You may use new DOM approach for HTML to PDF conversion. Please try following code snippet, it will fix the issue.

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

// use the new conversion engine<o:p></o:p>

options.UseNewConversionEngine = true;<o:p></o:p>

// load HTML file<o:p></o:p>

Document pdfDocument = new Document(“Input.html”, options);

// save output as PDF format<o:p></o:p>

pdfDocument.Save(myDir + “Output.pdf”);

<o:p>
</o:p>

<o:p>Please feel free to contact us for any further assistance.</o:p>


Best Regards,