In our online enrollment application, the user has the option to print our their application via a printer friendly Summary page. When the user actually submits the application, we capture the HTML for this Summary page in the background. We are attempting to convert this to PDF in order to store it for auditing purposes.
In the attached Word doc, you can see a portion of the actual HTML as displayed in the browser, what the Aspose conversion to PDF looks like, and the code used to create it.
A few observations:
- The base path given in the LoadOptions seems to work for images (note the logo at the top), but doesn’t seem to work for the CSS files. The layout and colors in the CSS have not been applied to the PDF.
- No matter what I try, I cannot affect the page layout. It appears that the default page layout is A4, not Letter. Also, the layout is Portrait and not Landscape. Using the examples from the Aspose website and forums, I have attempted to change this to Letter and Landscape, but the resulting PDF is always the same.
- I also noticed that with our custom controls, there are time where an input text box is hidden by having the text box enclosed in a
and setting the style on the
to “display: none”. When this is done, the text box is visible in the output PDF.
I am not sure where to go from here. I think the first issue is getting Aspose to recognize and process the CSS. The hidden field thing is a close second.
Thanks in advance for any assistance!
Milt
Hi Milt,
Thanks for your interest in Aspose. We will appreciate it if you please share your sample HTML along with resource files, so we will test the scenario and will provide you information accordingly.
We are sorry for the inconvenience.
Best Regards,
I have attached a zip file that contains:
- HTML source - SummaryPrint.html
- CSS and image files
- PDF file result of Aspose conversion - SummaryPrint.pdf
Hi Milt,
Thanks for sharing your sample documents. I am looking into the issue and will update you soon.
Best Regards,
Hi Milt,
I am sorry for the delayed response. I have tested the scenario and noticed that CSS is not being honored in conversion, but I am afraid CSS is not working in source html as well. I will appreciate it if you please share a sample project to replicate the issue. It will help us to address your issue exactly.
Furthermore, it seems you are using a old version(10.6.0) of Aspose.Pdf for .NET. It is recommended to use latest version of
Aspose.Pdf for .NET as later version has number of improvements/enhancements and fixes.
We are sorry for the inconvenience.
Best Regards,
This HTML is a page generated from ASP.Net that I captured in an attempt to make it easier to deal with, since our project is quite large and complex. I have updated the HTML so that the images and CSS files are fully qualified, and I have attached the update here. I know we can deal with relative paths too, but this should help you see the rendered page appropriately.
Hi Milt,
Thanks for sharing the HTML file again. I have tested the scenario using Aspose.Pdf for .NET 11.9.0. I have noticed that API is not honoring CSS files and display CSS property, so I have logged following issues in our issue tracking system for further investigation and rectification. We will notify you as soon as these issues are resolved.
PDFNET-41364: API is not honoring CSS files
PDFNET-41365: Hidden fields issue
We are sorry for the inconvenience.
Best Regards,
The issues you have found earlier (filed as PDFNET-41365) have been fixed in Aspose.PDF for .NET 23.9.
The issues you have found earlier (filed as PDFNET-41364) have been fixed in Aspose.PDF for .NET 24.5.