Skip to main content

Posts

Showing posts from 2011

Java Program to Convert HTML file to PDF file

Hi Friends, This is a small effort to explain " How to convert HTML file to PDF through java program ? " Lets start step by step approach, The open source java project " flyingsaucer (XHTML Renderrer )" helps us to convert X HTML file PDF file. But, usually the input that we provide will be in HTML format instead of XHTML. So, the first step that we need to follow is to convert HTML file to XHTML . JTidy (another open source java project) helps us to do the above conversion. Steps to convert HTML to XHTML: 1. Download JTidy from  http://sourceforge.net/projects/jtidy/files/JTidy/r938/jtidy-r938.zip/download  url. 2. Extract it - You will find  jtidy-r938.jar 3. Sample.html  (HTML file content). Save this in C:\ as sample.html file name <html> <head> <body> <h2>JTidy is a Java port of HTML Tidy, a HTML syntax checker and pretty printer.</h2> <p> Like its non-Java cousin, JTidy can be used as a tool for clea...