iText 2.1.7 — Is it possible to convert from PDF to HTML
As the latest iText versions are licensed under AGPL I have to use iText
2.1.7. I want convert a PDF back to HTML which was originally converted by
iText from HTML to PDF. Below is the code from HTML to PDF:
String k = "<html>.....</html>";//a html string
try {
OutputStream file = new FileOutputStream(new File("C:\\Test.pdf"));
Document document = new Document();
PdfWriter.getInstance(document, file);
document.open();
HTMLWorker htmlWorker = new HTMLWorker(document);
htmlWorker.parse(new StringReader(k));
document.close();
file.close();
} catch (Exception e) {
e.printStackTrace();
}
I want to know if is there any method to reverse the PDF to HTML.
By the way, when I parse HTML to PDF using the above code, the font and
background-color CSS styles are lost in the PDF. The latest version of
iText is able to keep the styling.
No comments:
Post a Comment