List of usage examples for org.apache.pdfbox.tools PDFText2HTML PDFText2HTML
public PDFText2HTML() throws IOException
From source file:org.xwiki.test.misc.PDFTest.java
License:Open Source License
private String getPDFContent(URL url) throws Exception { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); InputStream is = connection.getInputStream(); PDDocument pdd = PDDocument.load(is); String text;//from w w w . jav a 2s.c om try { PDFText2HTML stripper = new PDFText2HTML(); text = stripper.getText(pdd); } finally { if (pdd != null) { pdd.close(); } if (is != null) { is.close(); } } return text; }