tabula-java
tabula-java copied to clipboard
java.lang.UnsupportedOperationException not able to convert pdf text to csv
I dont see commas when test your file src/test/resources/technology/tabula/eu-002.pdf using java. So i am getting out the rectangle and trying to extract , but getting UnsupportedOperationException. // the algorithm we're going to be testing NurminenDetectionAlgorithm detectionAlgorithm = new NurminenDetectionAlgorithm();
List<Rectangle> tablesOnPage = detectionAlgorithm.detect(page);
for (int j = 0; j < tablesOnPage.size(); j++) {
Rectangle rectangle = tablesOnPage.get(j);
Ruling ruling=new Ruling(
(float) (rectangle.getTop() / 100 * page.getHeight()),
(float) (rectangle.getLeft() / 100 * page.getWidth()), (float) (rectangle.getWidth() / 100 * page.getWidth()),
(float) (rectangle.getHeight() / 100 * page.getHeight())
);
List<Ruling> rules=new ArrayList<>();
rules.add(ruling);
BasicExtractionAlgorithm bea = new BasicExtractionAlgorithm(rules);
Table table=bea.extract(page).get(j);
(new CSVWriter()).write(sw, table);