Converting Html page to PDF

Hi…


I’m planning to purchase Aspose.Pdf for Java module and I want to ask few question before I decide.

1. Is it possible long and complex html page to PDF?

The screen capture of the example page is attached
The page to convert only uses table tags and css.

2. I also need to put company information on the footer section of each page.
is it possible?




Hi Sooyong,


Thanks for your interest in Aspose.

Yes you can convert Complex HTML to PDF using Aspose.Pdf for Java. If you are referring some external resouces(images/fonts/CSS) then you need to pass base path of these resources to HtmlLoadOptions) object.

Furthermore you can set Page Header/Footer using HeaderFooter() object as following. However if you face any issue then please share your sample HTML here, we will look into it and will guide you accordingly.

//header table

com.aspose.pdf.Table table1 = new com.aspose.pdf.Table();

table1.setColumnWidths(“150 150”);

com.aspose.pdf.Row row1 = table1.getRows().add();

//add table cells

row1.getCells().add(“Column 1”);

row1.getCells().add(“Column 2”);

row1.setBorder(new com.aspose.pdf.BorderInfo(BorderSide.Bottom, .5f, com.aspose.pdf.Color.getLightGray()));



com.aspose.pdf.HeaderFooter header = new com.aspose.pdf.HeaderFooter();

header.getParagraphs().add(table1);

page.setHeader(header);

doc.save(outputPath);

Best Regards,

  1. Is it possible long and complex html page to PDF?
    Hi Sooyong,

Thanks for contacting support.

Aspose.Pdf for Java offers the feature to convert HTML pages to PDF format and honors the HTML/CSS information during conversion. For more information, please visit Convert HTML to PDF Format. In case you encounter any issue, please share the input HTML file.

  1. I also need to put company information on the footer section of each page.
    is it possible?

In order to accomplish this requirement, once the PDF file is generated, you can add footer on each page. For further details, please visit Adding Image Stamp in PDF File