开发者

Can iText 5 convert PDF to HTML?

开发者 https://www.devze.com 2023-03-17 23:45 出处:网络
I used iText 5 to create a nice looking report which includes some tables and graphs. I wonder if iText lets you convert PDF to HTML and if so .. how can one do it?

I used iText 5 to create a nice looking report which includes some tables and graphs. I wonder if iText lets you convert PDF to HTML and if so .. how can one do it?

I believe 开发者_如何学JAVAprevious versions of iText allowed it, but in iText 5 i was not able to find a way to do this.


No. iText has never converted PDF to HTML, only the reverse.


Have you had a look at http://www.jpedal.org/pdf_to_html_conversion.php - there is currently a free beta.


Possible to do with Apache Tika (it uses Apache PDFBox under the hood):

public String pdfToHtml(InputStream content) {
    PDDocument pddDocument = PDDocument.load(content);
    PDFText2HTML stripper = new PDFText2HTML("UTF-8");
    return stripper.getText(pddDocument);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消