Hi,
Hi,
Thanks for your inquiry.
tvkreddy92:
Hi,
We have an URGENT requirement where we would like to convert HTML to PDF using Aspose PDF for Java. The requirements are provided below :
- Ability to generate PDF from HTML String.
- Set the Author, Document Title.
- Set Page Headers, Footers.
- Set Page Size, Margin and Rotation Angle.
- Disable all hyperlinks in the generated pdf.
- Add multiple URL’s : the location of Custom CSS.
- Specify base URL to look up referred resources like images or CSS.
Output : a byte array of the generated PDF content.
You can accomplish your requirements in two steps using Aspose.Pdf for Java. In first step convert HTML to PDF and in second step you can update PDF accordingly and save output to byte array.
You are right you can convert HTML to PDF using HtmlLoadOptions. You may either pass html file or stream(html string) to Document constructor for conversion. You can pass basepath of images/css to HtmlLoadOptions, treated as database for images/css. PageInfo property will be used for setting page size and margins.
After creating PDF document you can set rotation angle, header/footer, add hyperlinks using Aspose.Pdf for Java. Moreover, you can remove hyperlinks by searching linkAnnotations and set actions to null but I am afraid currently it is malfunctioning. We have already logged a ticket PDFNEWJAVA-34106 in our issue tracking system for rectification.
Moreover, in reference to Aspose.Words for Java prospective. I am moving thread to Aspose.Total and my colleague will update you about your requirements of HTML to PDF conversion.
Please feel free to contact us for any further assistance.
Best Regards,
Hi Tvk,
As far as Aspose.Words for Java is concerned, you can find all of your required features except rotation angle and disabling hyperlinks in the output PDF. You will have to use Aspose.Pdf for Java for these features.
If you want to use Aspose.Words for Java remaining features (other than two above mentioned features), you can download Aspose.Words for Java and check LoadOptions , HeaderFooter and PageSetup classes, and IResourceLoadingCallback interface in the doc folder of installation directory for detailed examples.
You can also check Work with Document Properties example to set title.
Best Regards,