Free Support Forum - aspose.com

HTML to PDF Not Rendering Correctly

I have an issue, I am trying to use Aspose.pdf 7.4 to generate a PDF from an ASPX page. It is not pulling in the images and the formatting is really poor. Below is the code I am using to generate the PDF.

Dim pd As New Aspose.Pdf.Generator.Pdf

pd.HtmlInfo.ImgUrl = http://localhost:57908/Images/

pd.BindHTML(s)

pd.Save(C:\MyTestPDF.PDF")

Attached is the HTML I am feeding to the s variable above as well as two PDF's, one is how it should look (created by using a PDF printer not Aspose) and the other is the pdf created by aspose. (the html has a.txt extension)

I am hoping someone can review and let me know how I can make this work by creating the PDF using Aspose.

Hi Jeremy,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for the details.

Please share your sample application with .aspx page and images folder with us as I am not able to generate the PDF file using the HTML you have shared. It only shows “Version:” in generated PDF file using the file you shared.

Sorry for the inconvenience,

Im sorry, the actual html I am pushing through has the header info scraped off of it. Here is another file.

Besides that, the file I submitted previously will render in a browser if you change the extension to .html. If it renders in a browser shouldn't it also render correctly for the PDF? The file I have provided you below also renders correctly in a browser if the extension is changed to .html

The project won't work at all for you as there are tables in the backend that are needed. I have attached the project here for you though.

I can feed the file attached to the pd.BindHtml method and it generates the incorrectly formatted pdf listed in my last post.

Hi Jeremy,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the template file.

I am able to reproduce your mentioned issue after an initial test. Your issue has been registered in our issue tracking system as PDFNEWNET-34527. You will be notified via this forum thread regarding any updates against your issue.

Regarding your previous file, I will further investigate and see why it is showing properly in browser but not converting properly and get back to you soon.

Sorry for the inconvenience,