Web Page to PDF using Print CSS is not working

Hi,


We are trying to convert a Web Page into PDF using ASPOSE.PDF version 11.1 and we are trying to use Print CSS to make it look good. But, PDF output is not using the CSS. We followed the code mentioned in
public Aspose.Pdf.LoadOptions.ResourceLoadingResult ExternalImagesLoader(string resourceURI)
{
if (!resourceURI.ToUpper().Contains(“HTTP”))
{
if (resourceURI.StartsWith("/"))
{
Uri uri = new Uri(baseUrl);
resourceURI = uri.Scheme + “://” + uri.Host + resourceURI;
}
else
{
resourceURI = baseUrl + resourceURI;
}
}
Aspose.Pdf.LoadOptions.ResourceLoadingResult result = new LoadOptions.ResourceLoadingResult(new byte[0]);
var webClient = new WebClient();
webClient.Credentials = CredentialCache.DefaultCredentials;
byte[] imageBytes = webClient.DownloadData(resourceURI);

result = new Aspose.Pdf.LoadOptions.ResourceLoadingResult(imageBytes);
if (resourceURI.ToUpper().EndsWith(".CSS"))
{
result.MIMETypeIfKnown = “text/css”;
result.LoadingCancelled = true;
}
return result;
}

Hi,


Would appreciate if you could kindly look into this as it is critical requirement for our project. Thanks in advance.

Best Regards,
Aravind

Hi Aravind,


Thanks for contacting support.

Can you please share the resource HTML and CSS, so that we can test the scenario in our environment. We are sorry for this inconvenience.

Hi,


Please find the below example. It is a public facing website. I have also attached a copy of HTML and CSS. I tried with latest ASPOSE version ASPOSE.PDF 11.4.0 and still, it is not working. I am attaching “Expected_PDF.pdf” (using PRINT CSS, taken manually) and “Actual_PDF.pdf” for your reference. Kindly let me know if you need more details.

Would appreciate your assistance.

HTML: http://www.imf.org/external/ks5101/crystal/wcm_dec15/factsheet_detail.htm
CSS: http://www.imf.org/external/ks5101/crystal/wcm_dec15/css/styles.css

Thanks,
Aravind

Hi,


Could you please upgrade this issue to Priority Support Forum? Please let me know if you need any licensing details for this.

Thanks,
Aravind

Hi Aravind,


Thanks for conctacting support.

We are working on replicating the issue using resource files which you have recently shared and will get back to you soon.

Hi Aravind,


Thanks for your patience.

I have tested the scenario and have managed to reproduce the same problem (CSS is not being honored during HTML to PDF conversion). For the sake of correction, I have logged it as PDFNEWNET-40533 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this incon
aravindayyanar:
Could you please upgrade this issue to Priority Support Forum? Please let me know if you need any licensing details for this.
Hi Aravind,

Currently the issue is logged with normal/low priority because I cannot see Priority Support badge with your current aravindayyanar username. Please note that in order to access Priority Support forum, you need to have an explicit subscription. If you have already purchased Priority Support, please share the username against which you have purchased PS, so that we can further look into this matter.

Hi,


We recently got the Priority Support and username is “joshuasampson”. Email address is "jsampson@imf.org". Would appreciate if you could do the needful as soon as possible, as it is critical for your project.

Thanks,
Aravind

Hi Aravind,


Please raise a request in Priority Support forum using above stated username and indicate earlier shared issue ID in that post and we will raise the priority and intimate accordingly.

Hi,


Thanks for looking into this issue and your support. We have now raised a priority support ticket for this issue.

Regards,
Aravind

Hi Aravind,


The request will be entertained in respective forum thread in the event of any further query, please feel free to contact.