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

Free Support Forum - aspose.com

HTML to PDF muliple saving issue

Hello,

I have a html file with image:
Test for Inline style and CSS support
h1 {color:red; display:inline;font-family: ‘Arial’}
h2{text-decoration:underline;font-family: ‘Courier new’}
a {color:pink; display:inline; text-decoration:italic; font-family:
‘Arial Black’}

Aspose.Pdf for .NET

This is sample Heading at level 2

C:\image0.jpg
some sample text with CSS support

When I save it to PDF two times, second pdf file contains an error and no image is shown (see atachements).
Below is C# code I am using
Aspose.PDF version is 8.5.0

string html = File.ReadAllText(@“C:\HTML_TEST1.html”);
var pdf = new Aspose.Pdf.Generator.Pdf();
pdf.Conformance = Aspose.Pdf.Generator.PdfConformance.PdfA1B;
pdf.ParseToPdf(html);
pdf.Save(@“C:\FIRST_SAVE.pdf”);
pdf.Save(@“C:\SECOND_SAVE.pdf”);

Am I doing something wrong?
Thank you
Alexei

Hi Alexei,


Thanks for your inquiry. While testing the scenario with Aspose.Pdf for .NET 8.5, we've managed to reproduce the reported issue on our side and logged it in our bug tracking system for further investigation and resolution, the issue ID is PDFNEWNET-36001. We've also linked your request to this issue and you will be notified via this forum thread as soon as it is resolved.

Please feel free to contact us for any further assistance.

Best Regards,

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

The blog post for this release is created over this link


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

Hi Alexei,


Thanks for your patience. As informed above, your reported issue has been resolved.

Please use following code snippet, based on new Document Object Model (DOM)., with latest release of Aspose.Pdf for .NET. It will serve the purpose.

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

// use the new conversion engine

htmloptions.UseNewConversionEngine = true;

Document doc = new Document(myDir+"input.htm", htmloptions);

doc.Convert(new MemoryStream(), PdfFormat.PDF_A_1B, ConvertErrorAction.Delete);

doc.Save(myDir+"First_save.pdf");

doc.Save(myDir + "Second_save.pdf");

Please feel free to contact us for any further assistance.


Best Regards,