I’m having a problem with pdf conversion and external css files. I’ve set pdf.HtmlInfo.ExternalResourcesBasePath to the appropriate path and set text.IsHtmlTagSupported=true but the css styles are still not being applied. Any idea what I’m doing wrong? Thanks
Hi Rick,
Thank you for using our products.
Kindly share some details regarding sample source code and template documents (HTML and CSS) you are using or create a sample application to show the issue. This will help us to figure out the exact issue and reply back to you soon.
We apologize for your inconvenience.
Thanks & Regards,
I abandoned the approach I was taking due to time constraints. I'm now embedding the css directly into the html. However, when I try to Save to a memorystream, the call never comes back (or, at least not after 5 minutes). Here's the code:
public bool GeneratePDFFromHTMLText(string html, string imgPath, out MemoryStream pdfMemoryStream, out string errMsg)
{
bool success = true;
string methodName = _className + "GeneratePDFFromHTMLFile(): ";
// Init returned params.
pdfMemoryStream = new MemoryStream();
errMsg = "";
try
{
// Instantiate a PDF class
Aspose.Pdf.Generator.Pdf pdf;
if (!(success = GetPDFDocument(out pdf, out errMsg))) throw new Exception(errMsg);
// add the section to PDF document sections collection
Aspose.Pdf.Generator.Section section = pdf.Sections.Add();
//Create text paragraphs containing HTML text
Aspose.Pdf.Generator.Text text = new Aspose.Pdf.Generator.Text(section, html);
// enable the property to display HTML contents within their own formatting
text.IsHtmlTagSupported = true;
// Want to fit-to-page;
text.IsFitToPage = true;
//Add the text paragraphs containing HTML text to the section
section.Paragraphs.Add(text);
// Specify the URL to find images
pdf.HtmlInfo.ImgUrl = imgPath;
//Save the pdf document
pdf.Save(pdfMemoryStream);
}
catch (Exception ex)
{
success = false;
errMsg = methodName + ex.ToString();
}
return success;
}
I've attached a file containing the html. I should add that opening the attached file in a browser renders correctly (you have to rename it from .txt to .html).
Thanks
Hi Rick,
Thanks for sharing the sample source code and template documents with us.
I tested the scenario and able to notice the same problem. For rectification, I logged this problem with ID: PDFNEWNET-33714 in our Issue Tracking System. We will further look into the details of this issue and will keep you updated via this forum thread on the status of correction.
We apologize for your inconvenience.
Thanks & Regards,
Any updates on this issue? Thanks
Hi Rick,
Thanks for your patience.
I have verified the status of this issue from our issue tracking system and regret to share that this issue is still unresolved. Currently it is pending for analysis and is in the queue. Also, at the moment we can't provide you the ETA for this issue. However, I have requested the development team to share the ETA regarding its resolution. As soon as we get required information, we will be more than happy to update you with the status of correction. Please be patient and spare us little time.
We apologize for your inconvenience.
Thanks & Regards,
It’s been almost 3 weeks since I posted my issue but I still don’t even have an ETA for a resolution. I’m being asked almost daily by my management when we’re going to have a fix. Can you please give me some idea when this issue will be resolved? Thanks
Hi Rick,
Thanks for your patience.
I have verified the status of this issue from our issue tracking system and regret to share that this issue is still unresolved. Currently it is pending for analysis and is in the queue. Also, at the moment we can't provide you the ETA for this issue. However, I have notified the development team of your concern. As soon as, any information is shared by them, we will be more than happy to share that with you.
We are really sorry for the delay and inconvenience.
Thanks & Regards,
Hi Rashid,
I'm having the same problem.
I have a question: Why is "HTML to PDF conversion" listed as a feature of this product if CSS doesn't work and there is no work-around?
Please help.
Regards,
Dan
Hi Dan,
Thanks for using our products.
Kindly check the following documentation link for details and code snippets as per your requirement.
How to convert HTML to PDF using InLineHTML approach
If you still face any issue, please share some details regarding sample source code and template documents you are using or create a sample application to show the issue. This will help us to figure out the exact issue and reply back to you soon.
We apologize for your inconvenience.
Thanks & Regards,
Rashid,
I have the same problem as Rick. MemoryStream is crashing. Please try to be more helpful. Thanks.
Dan
Hi Dan,
Thanks for your inquiry.
Our development team is working on this issue and you will be updated via this forum thread with the status the earliest possible.
We apologize for your inconvenience.
Thanks & Regards,
Hi,
Thank you for your patience.
I am very pleased to inform you that the issue is resolved by the development team and this issue will be a part of Aspose.Pdf for .NET v7.1 (to be released in June as per our monthly release plan) after following the complete testing and release cycle. Please be patient and we will notify you once the version is available for download.
We apologize for your inconvenience.
Thanks & Regards,
Hi Rashid,
It is now July, is v7.1 released yet? I was hoping this CSS issue would be resolved.
Hi Quang,
Thanks for your patience.
We are still busy with the testing of Aspose.Pdf for .NET v7.1 and it's not yet ready to be published. Please be patient and spare us some time to complete our testing and publishing process. We will notify you via this forum thread once the latest release is available for download. We will try our level best to release the product ASAP. We are really sorry for the delay and inconvenience.
Thanks & Regards,
The issues you have found earlier (filed as PDFNEWNET-33714) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.