Cómo leer tablas en pdf usando java
/**
* @param pdf Ruta del archivo PDF
* @param txt Ruta del archivo de texto de salida
* @throws IOException
*/
public void parsePdf(String pdf, String txt) lanza IOException {
Lector de PdfReader = nuevo PdfReader(pdf);
p>
PrintWriter out = new PrintWriter(nueva
estrategia TextExtractionStrategy;
for (int i = 1; i <= lector.close( );
}
Método del complemento PDFBOX
Documento PDDocument = PDDocument.load( args[0] );
if ( document.isEncrypted() )
p>{
document.decrypt( " " );
}
PDFTextStripperByArea stripper = new PDFTextStripperByArea();
stripper.setSortByPosition( true );
Rectángulo rect = nuevo Rectángulo ( 10, 280, 275, 60 );
stripper. addRegion(addRegion( "class1", rect );
Listar todas las páginas = document.getDocumentCatalog().getAllPages();
PDPage firstPage = (PDPage)allPages.get( 0 ) ;
stripper.extractRegions ( primera página );
System.out.println( "Texto en la región: " + rect );
System.out.println ( stripper.getTextForRegion( "clase1" );