Hi,
I want to convert the html content into the pdf format.
How can i do this.
Here is my code that converts only the text items into the pdf and it omitted all the textboxes, textareas, checkboxes.....
import java.io.FileOutputStream;
import java.io.FileReader;
import java.util.ArrayList;
import com.lowagie.text.Document;
import com.lowagie.text.Element;
import com.lowagie.text.html.simpleparser.HTMLWorker;
import com.lowagie.text.html.simpleparser.StyleSheet;
import com.lowagie.text.pdf.PdfWriter;
public class generatePdf {
public static void main(
String[] args) throws Exception {
Document document = new Document();
StyleSheet st = new StyleSheet();
st.loadTagStyle("body", "leading", "16,0");
PdfWriter.getInstance(document, new FileOutputStream("c:/MissedVisit.pdf"));
document.open();
ArrayList p = HTMLWorker.parseToList(new FileReader("c:/MissedVisit.html"), st);
for (int k = 0; k < p.size(); ++k)
document.add((Element) p.get(k));
document.close();
System.out.println("Pdf Generated!");
}
}
Any pointers to this to get all the contents that are in Html.