I am trying to get an HTML page (stored locally) rendered to PDF using Aspose PDF. Unfortunately, all the layout and styling are being lost - all I get is the text (not the raw HTML.) Thinking I was doing something wrong, I tried using HTMLBind([website on Internet]) and that threw this error...
2 Errors when parsing the html document
Aspose.Pdf.HTML.? Aspose.Pdf.HTML.?
We save the fixed html document as the xml file : C:\Documents and Settings\pet8
6064.FGG\Local Settings\Temp\tmp113.html.xml .
Actually we just simply fixed the nested tags such as li,ol,ul.
We don't know whether it is right to fix it as we have done.
If you meet the console error information,try to fix the errors by yourself and
regenerate pdf with this toolkit later.
Here is my code for trying to render the local HTML file...
private void HtmlBaseFileToPdf(string filename, string strExt)
{
try
{
// get the root name of the file (name w/o extension.)
string rootFilename = filename.Substring(0, filename.LastIndexOf(".") + 1);
Pdf pdf = new Pdf();
pdf.BindHTML(strPdfOutput + @"\temp\" + rootFilename + strExt);
pdf.Save(strPdfOutput + @"\" + rootFilename + "pdf");
}
catch (Exception ex)
{
System.Console.Write(ex.Message);
}
}
What I need is to render the html file as WYSIWYG (or very close to it) to PDF using Aspose products. My question to you is this...Can Aspose products accomplish this task?