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”);