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

Free Support Forum - aspose.com

Identify errors or issues in conversion

Hi,


I am evaluating Aspose for PDF creation from HTML files. How do I identify if there were any errors in conversion? The method returns successfully even when there are issues with the conversion. I notice there is a WarningInfo class but don’t see this being exposed by the Pdf object. Can someone help me out? Here is my sample code:

// Instantiate an object PDF class
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(@“F:\CodeSamples\PdfTest\PdfTest\PdfTest\bin\Debug\Profile.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);

//Add sencond html
StreamReader r2 = File.OpenText(@“F:\CodeSamples\PdfTest\PdfTest\PdfTest\bin\Debug\Education.html”);
Aspose.Pdf.Generator.Section section2 = pdf.Sections.Add();
Aspose.Pdf.Generator.Text text3 = new Aspose.Pdf.Generator.Text(section2, r2.ReadToEnd());

// enable the property to display HTML contents within their own formatting
text3.IsHtmlTagSupported = true;
//Add the text paragraphs containing HTML text to the section
section2.Paragraphs.Add(text3);

// Specify the URL which serves as images database
pdf.HtmlInfo.ImgUrl = “”;

//Save the pdf document

pdf.Save(@“F:\CodeSamples\PdfTest\PdfTest\PdfTest\bin\Debug\test.pdf”);

Hi there,


Thanks for your inquiry. I’m afraid the IWarningCallback is not available in Aspose.Pdf.Generator namespace but implemented in Aspose.Pdf namespace. I’ve logged a ticket as PDFNEWNET-35445 in our issue tracking system for the requirements. We will keep you updated about issue progress via this form thread.

Moreover, Can you please share the source document and the issues you are facing in HTML to PDF conversion? So we will look into these and will provide you information accordingly. Please also check the documentation link for known issues in HTML to PDF conversion.

Sorry for the inconvenience faced.

Best Regards,