Hi I am having problem converting HTML string to PDF by using DOM approach.
Hi ShiJien,
Thanks for using our API.
I have tested the scenario using Aspose.Pdf for .NET 9.4.0 where I have made a slight change in your code and as per my observations, the PDF file is properly being generated. I do not have Segoe UI, Meiryo, and other custom fonts installed on my system. Can you please share which version of API you are using and also please share the resource font file so that we can retest the scenario at our end. We are sorry for your inconvenience.
[C#]
string emailBodyDetails = "<html><body><SPAN STYLE=\"FONT-FAMILY: Calibri, 'Segoe UI', Meiryo, 'Microsoft YaHei UI', 'Microsoft JhengHei UI', 'Malgun Gothic', sans-serif; FONT-SIZE: 16px\">Content.</SPAN></body><html>";
using (FileStream fs = new FileStream("c:/pdftest/tempOutput.html", FileMode.Create))
{
using (StreamWriter w = new StreamWriter(fs, Encoding.UTF8))
{
w.WriteLine(emailBodyDetails);
}
fs.Close();
}
Aspose.Pdf.Document doc = new Aspose.Pdf.Document("c:/pdftest/tempOutput.html", new HtmlLoadOptions() { UseNewConversionEngine = true });
doc.Save("c:/pdftest/Conversion_Output.pdf");
I am using Aspose.Pdf for .NET 9.2.1.0 at my end. I do not have the resource font file, as this is a sample html email content I retrieved from database with some random font style which I have no control over it. I keep getting error during conversion, until I remove the Meiryo style from the html and it works fine. Please advise. Thank you.
Hi ShiJien,
Hi,
shijient_ppc: Hi,
Can you please try again with this HTML string as follow, using the same approach I’ve mentioned above.
Content
For this HTML, it will fail. I am suspecting maybe the
**<strong>**
tag is having conflict with the theMeiryo
style. You can only have either one of them in the HTML. If both are present, conversion will fail. Please advice on how can this be fix. I need this urgently. Thank you.
Hi ShiJien,
Thanks for sharing the details.
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-37250. We will investigate this issue in details and will keep you updated on the status of a correction.
We apologize for your inconvenience.
Hi,
Hi ShiJien,
unless we have investigated and have figured out the actual reasons of this
problem, we might not be able to share any timelines by which this problem will
be resolved.
resolution of this issue, we would be more than happy to update you with the
status of correction. Please be patient and spare us little time. Your patience
and comprehension is greatly appreciated in this regard.
Hi,
Hi ShiJien,
The issues you have found earlier (filed as PDFNEWNET-37250) have been fixed in Aspose.Pdf for .NET 9.6.0.
Hi, I have just tested the scenario above with the new release of Aspose.Pdf for .NET 9.6.0. but the problem doesn’t seem to have solved. Can you please verify the ticket <span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-ansi-language:
EN-US;mso-fareast-language:ZH-CN;mso-bidi-language:AR-SA”>PDFNEWNET-37250? Immediate attention from you is greatly appreciated. Thank you.
Hi, is there any support personel that can assist me in this? I am really looking urgently into some help. Thank you.
Hi ShiJien
Thanks for your inquiry. I’m afraid we tested again with the following code using Aspose.Pdf for .NET 9.6.0 and were unable to replicate the issue. We would appreciate it if you could share a console application to demonstrate the problem. We will test the scenario and update you accordingly.
string emailBodyDetails = "Content";
using (FileStream fs = new FileStream(@"tempOutput.html", FileMode.Create))
{
using (StreamWriter w = new StreamWriter(fs, Encoding.UTF8))
{
w.WriteLine(emailBodyDetails);
}
}
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(@"tempOutput.html", new HtmlLoadOptions() { UseNewConversionEngine = true });
doc.Save(@"Conversion_Output.pdf");
We are sorry for the inconvenience caused.
Best Regards,
Hi,
Please try with this string.
string emailBodyDetails = “Content”;
Hi ShiJien,
Hi,
Hi,
Hi ShiJien,
Hi,