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

Free Support Forum - aspose.com

Crashes when rendering this HTML to PDF



string html = "

matinibwas developed in the late 1990s

\r\n\r\n

by biochemist Nicholas Lydon, a former\r\nresearcher for Novartis, and oncologist Brian Drukerof Oregon Health and\r\nScience University (OHSU). Other major contributions to

imatinibdevelopment\r\nwere made by Carlo Gambacorti-Passerini, a physician scientist at University of\r\nMilano Bicocca(http://www.unimib.it), Italy, John Goldman at Royal Hammersmith\r\nHospital in London, UK, and Charles Sawyers of Memorial Sloan-Kettering Cancer\r\nCenter,[2] who led the clinical trials confirming its efficacy in CML.";

Text t = new Text(html);
t.IsHtmlTagSupported = true;
paragraphs.Add(t);

then it crashes when saving PDF files.

Hello Tony,

Thanks for your interest in our products.

The source HTML string needs to be updated so that it can properly be converted into PDF format. Please replace " with ' and try converting it into PDF format. I have tested the scenario using Aspose.Pdf for .NET 5.3.0 and I am unable to notice any problem. Please have a look over attached PDF document.

Mean while I am working on issue related to formatting which is occurring while generating the PDF document. Please be patient and spare us little time. We apologize for your inconvenience

[C#]

//Instantiate a pdf document
Pdf pdf1 = new Pdf();
//Create a section in the pdf document
Aspose.Pdf.Section sec1 = pdf1.Sections.Add();
//Create string variables with text containing html tags
string s = "

matinibwas developed in the late 1990s

\r\n\r\n

by biochemist Nicholas Lydon, a former\r\nresearcher for Novartis, and oncologist Brian Drukerof Oregon Health and\r\nScience University (OHSU). Other major contributions to imatinibdevelopment\r\nwere made by Carlo Gambacorti-Passerini, a physician scientist at University of\r\nMilano Bicocca(http://www.unimib.it), Italy, John Goldman at Royal Hammersmith\r\nHospital in London, UK, and Charles Sawyers of Memorial Sloan-Kettering Cancer\r\nCenter,[2] who led the clinical trials confirming its efficacy in CML.

";

//Create text paragraphs containing HTML text
Text text1 = new Text(s);
text1.IsHtmlTagSupported = true;
//Add the text paragraphs containing HTML text to the section
sec1.Paragraphs.Add(text1);
//Save the pdf document
pdf1.Save("d:/pdftest/newTestHtml.pdf");

I know it is the " thing causing the crash. What I like is you can escape them from your side. At least, it should not crash the program. Thanks.

Hello Tony,

Yes you are correct. &quote; should be properly rendered or at least the error should not be displayed. I have already logged this issue as PDFNET-28654 in our issue tracking system. More along, I have also logged the formatting issue (resultant PDF does not contain text in appropriate font) in our issue tracking system as PDFNET-28650. We will further look into the details of these problems and will keep you updated on the status of correction. Please be patient and spare us little time. We apologize for your inconvenience.