Hello, I am working on converting a html file to PDF and I am wondering what the best route to take would be. I have been able to produce a PDF from the HTML document, but it is not rendering anywhere near where I would like it. What process do you recommend for taking an html file and converting it to PDF while rendering the html within the document? I have searched through the forums and support links, but unsure how to go about incorporating some of the recommendations with Classic ASP. Any help on the best route to take would be greatly appreciated.
Hi Brett,
Thanks for contacting support.
In order to accomplish your requirement, I would recommend you to please try using Aspose.Pdf for Cloud API. For further information, please visit Create PDF from HTML
I’m not sure this is really what I am looking for. We currently have Aspose.Total for .NET and I am trying to implement this into a portion of our code where we are using Classic ASP. We would not be using any type of cloud services to accomplish this. Do you have any examples to accomplish this in classic ASP?
Hi Brett,
Thank you for the reply. I wanted to respond back with some examples of the issue I am running into. We are currently using the addImageURL function in ABCPDF to take an html input, convert it to PDF and display it to the screen. I have attached the HTML file being converted and the output when using ABCPDF. I tried to get an example of how Aspose.PDF was rendering this, but it kept erroring out on me this time. Would you be able to recommend the code that could be used to achieve similar results with Aspose.PDF? Thank you very much.
Dim pdf : Set pdf = CreateObject("Aspose.Pdf.Generator.Pdf") Dim pdfsection : Set pdfsection = CreateObject("Aspose.Pdf.Generator.Section") pdf.Sections.Add(pdfsection) Dim SampleText : Set SampleText = CreateObject("Aspose.Pdf.Generator.Text") SampleText.IsHtmlTagSupported = true Dim seg1 : Set seg1 = CreateObject("Aspose.Pdf.Generator.Segment") seg1.Content = "" & strBrowse & "" 'This is the content of the HTML file SampleText.Segments.Add(seg1) pdfsection.Paragraphs.Add(SampleText)
pdf.Save("c:\temp\Aspose PDF Output.pdf")
Hi,
Thanks for sharing the feedback.
I have noticed that you are using legacy Aspose.Pdf.Generator approach for HTML to PDF conversion. However in order to get better results, I would suggest you to please try using new Document Object Model (DOM) of Aspose.Pdf namespace. You may consider using following code snippet (after converting to ASP format) and see if it can fulfill your requirements.
[C#]
// load source HTML
Aspose.Pdf.Document pDC = new Aspose.Pdf.Document(@"C:\pdftest\Input+HTML+file\Input HTML file.htm", new HtmlLoadOptions());
// save output in PDF format
pdoc.Save(@"C:\pdftest\Input+HTML+file\Input HTML file.pdf");
Thank you for the response. I am still not receiving the desirable results using the code snippet above. I have re-attached the results of the Input HTML, the output using ABCPDF (the output that I am trying to match with ASPOSE), and the output using Aspose.PDF and the code above (converted to VB.NET). Can you try on your end using these files and see if you get similar results?
Hi Brett,
Would you be able to try on your end with the files provided in the last post and the most recent version of Aspose.PDF? I tried to download the most recent version, but the trial version will not accept more than 4 elements and the Aspose.Total.lic file I have only allows for updates up to Feb 2014. Before renewing the subscription to download the most recent updates, I would like to know if the newest version will resolve the problem.
BPepInfoed24:
Would you be able to try on your end with the files provided in the last post and the most recent version of Aspose.PDF?
Hi Brett,
In my earlier attempt, I have used the latest release of Aspose.Pdf for .NET.
BPepInfoed24:
I tried to download the most recent version, but the trial version will not accept more than 4 elements and the Aspose.Total.lic file I have only allows for updates up to Feb 2014. Before renewing the subscription to download the most recent updates, I would like to know if the newest version will resolve the problem.
In order to overcome the trail limitations, you may consider requesting a 30 days temporary license. For further details, please visit Get a temporary license
Please try using the latest release of Aspose.Pdf for .NET 9.8.0 and in case you still face any problem, please feel free to contact.
Thank you for the reply and the tip about acquiring a temporary license. I did that, downloaded the latest version of Aspose.PDF and tried again with the following code:
Dim pdf As New Aspose.Pdf.Document(htmlDocumentPath, New Aspose.Pdf.HtmlLoadOptions(HttpContext.Current.Server.MapPath("/")))
pdf.Save(outputPDFPath)
I have attached the new results as “New ASPOSE Output.pdf”. As you can see, if you compare it to the desired output in my previous post using ABCPDF, the output is still way off. Can you provide a different method of converting HTML so I can reach the desired output using ASPOSE? This issue is becoming more critical and time sensitive.
Hi Brett,
Thanks for sharing the feedback.
I have logged the formatting related issue in our issue tracking system as PDFNEWNET-37817. We will investigate this issue in details and will keep you updated on the status of a correction.
We apologize for your inconvenience.
Hello, any update on this?
Hi Brett,
The issues you have found earlier (filed as PDFNET-37817) have been fixed in Aspose.PDF for .NET 18.11.
It looks like this product can be used to read in an html file and output it as a PDF file. I can really use this kind of functionality for people who create reports on a few of my websites fron their smart phones where they do not have access to a wifi printer and wish to produce a PDF file of them so they can email them.
If this will work, please let me know the following:
- Price of the product
- Usability on a classic ASP site as far as having to register any of the dlls
Please email me at PaulGScannell@gmail.com
Thank you,
Paul
Yes, the API can be used with classic ASP. You can please check the respective documentation article for more information.
Please post your price and sales related inquiry in our Purchase forum where you will be assisted accordingly.