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

Free Support Forum - aspose.com

Html content to Pdf

Hello,

I'm trying to create a pdf with formatted text with the following code:-

public void DownloadCommentaries(string[] sCommentaries, string sFileName)

{

Pdf pdf1 = null;

Section oSection = null;

Text oText = null;

for (int iCount = 0; iCount < sCommentaries.Length; iCount++)

{

//Instantiate Pdf object by calling its empty constructor

pdf1 = new Pdf();

pdf1.IsPageNumberForDocument = true;

oSection = pdf1.Sections.Add();

oText = new Text(sCommentaries[iCount]);

oText.Margin.Left = 0.1F;

oText.Margin.Bottom = 0.1F;

oText.Margin.Right = 0.1F;

oText.Margin.Left = 0.1F;

oText.IsHtmlTagSupported = true;

oSection.Paragraphs.Add(oText);

}

MemoryStream oMemoryStream = new MemoryStream();

pdf1.Save(oMemoryStream);

//open document

Aspose.Pdf.Facades.Form oPdfForm = new Aspose.Pdf.Facades.Form(oMemoryStream, sFileName);

//flatten fields

oPdfForm.FlattenAllFields();

//save output

oPdfForm.Save();

}

My sCommentary is attached. I get an error "Illegal characters in path". Please let me know the reason for the same asap because the intention to use Aspose to create pdf from formatted text is of utmost importance.

Regards,

Viswanathan

Hi Viswanathan,

Thanks for using our products.<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif””>

I
have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-30750. We will investigate this
issue in details and will keep you updated on the status of a correction.<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif””><span style=“font-size:10.0pt;
font-family:“Arial”,“sans-serif””>

We apologize for your inconvenience.


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

Blog post for this release can be viewed over this link


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

Hi Viswanathan,


In reference to above fix, Please use new DOM approach for HTML to PDF conversion, it will help you to accomplish the task.

HtmlLoadOptions htmloptions = new HtmlLoadOptions();

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

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

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

Document doc = new Document(“input.html”, htmloptions);<o:p></o:p>

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

doc.Save(“output.pdf”);<o:p></o:p>


Please feel free to contact us for any further assistance.


Best Regards,