Giter Site home page Giter Site logo

traprange's Issues

Add a JAR without dependencies to allow other logging implementations

The only JAR available is packaging log4J implementation and it is forcing to use log4j as active logger in the projects using this.

I've been using this JAR with Spring Boot v2.2.5.RELEASE successfuly. I wanted to use current version 3.0.6 which benefits from way more recent java version and API but... I keep having exception saying I have to remove log4j logger factories from classpath if I want to use Logback.
I finally rolled back to v2.2.5.RELEASE to keep working.

This would not be a problem if it were published on maven repository (#19 ) I guess.

Please would it be ok to put a JAR without depdendencies in your repo ?

Adding an argument for specifying table position

Most tables do not occupy the whole pdf page. Can an argument be added so that users can specify the table position in the pdf? Only the region specified by the users is processed, instead of the whole pdf page.

Table column not getting extracted.

I tried the code with my pdf's, result was amazing. I found that rows are getting extracted but the problem is that columns are not getting extracted.

Can we get all PDF data into the String variable, instead of getting data page by page?

Hi a. Tho,

Currently, I'm using "get" method to get PDF data from specific page. I wonder that can we get all PDF data at once instead of getting data page by page like that?
My code:

public static int rowNumberOfPDFFile(String pdfLink, int pagePDFNumber) throws IOException {
PDFTableExtractor extractor = new PDFTableExtractor();
List

tables = extractor.setSource(pdfLink).extract();
// get date from page 1 to String html. Page number starts from 0
String html = tables.get(pagePDFNumber).toHtml();

    html = html.substring(html.indexOf("border='1'>") + 11);
    int rowNumber = org.apache.commons.lang3.StringUtils.countMatches(html, "/tr");
    return rowNumber;
}

I would like to get all PDF data into "html" field. Could you please help?

Thanks,
Phan Nguyen

Export to CSV

Hi. This is a really great package. Thanks so much.

I'm having one issue with exporting to CSV:

String csv = tables.get(0).toString();

I have a PDF table where the first column is sometimes empty. TrapRange discovers the column just fine, and export to HTML shows the column with the empty cell. But when I export to CSV, the empty cells are lost with no starting semicolon to denote them.

Do you experience the same?

Mike

Pages are numbered from 0 (in command-line options)

Hi, I noticed that page numbers are read incorrect from command line options like -p -ep and -el @.
I made sort-of-a-workaround in commit dc99b6c , but I actually think that it's better to fix either options parsing or page number checks in PDFTableExtractor#extract

Upgrade to pdfbox 2.0?

Hi,

Nice work! Are you planning to migrate to pdfbox 2.0??
The new API has vastly improved and it would be a big plus for the users wishing to migrate to pdfbox 2.0, since many functions have moved/been deleted along with some classes.

Would love to hear back!
Cheers

Error NotSuchMethod

While implementing the extractor on a main java method, I get the following error:

java.lang.NoSuchMethodError: com.google.common.collect.Range.closed(Ljava/lang/Comparable;Ljava/lang/Comparable;)Lcom/google/common/collect/Range;

The program is as follows:

PDFTableExtractor extractor = new PDFTableExtractor();
        extractor = extractor.setSource("C:/test.pdf");        
        extractor.addPage(0);
        extractor.exceptLine(0, new int[]{0, 1});  

        List<Table> tables = extractor.extract();    

         try (Writer writer = new OutputStreamWriter(new FileOutputStream("C:/Users/rys_s/Documents/MiArchivo.html"), "UTF-8")) {
                for (Table table : tables) {
                    writer.write("Page: " + (table.getPageIdx() + 1) + "\n");
                    writer.write(table.toHtml());
                }
        }

And the error comes apparently at the extractor.extract() line.

Missing input file

though i have given the path of the file its giving error as Missing input file..
Can u please update with this?

error testpdfbox.java

The method sort(new Comparator(){}) is undefined for the type List<Range> TESTPDFBox.java line 54

running java version 8 update 91

Included guava version 18 conflicts with selenium-java 3.12.0

When including the traprange jar in a project with selenium-java 3.12.0 in maven, the Guava version 18 conflicts. Attempting to instantiate a ChromeDriver object results in the following error:

java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124)
at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:33)
at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:139)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:335)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:89)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:123)

Solution is to use a more recent version of Guava.

Trying to understand the process of creating a cell

I am actually working on something to automatize the process of reading pdf tabs, the fact is that i actually get only on big collum with multiple row, while trying to dive into the process i actually saw that after extracting the TextPositions in the PDFTableExtractor.java class I get only one character by text position, where I suppose we are waiting to get a full cell, is this where my problem come from?
exempleTab
here is an example tab from my tests, there is also tons of empty columns and row that I delete myself in front.

The method sort underfined for the type List<Range<Integer>>

Hi, thoqbk! I have downloaded the repository and I find there existing some error when use maven to packaging the jar. The error message are as follows:

[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /E:/Repo/traprange-master/src/test/java/com/giaybac/traprange/test/TESTP
DFBox.java:[57,15] 找不到符号
  符号:   方法 sort(<匿名java.util.Comparator<com.google.common.collect.Range>>)

  位置: 类型为java.util.List<com.google.common.collect.Range<java.lang.Integer>>
的变量 ranges
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.129 s
[INFO] Finished at: 2015-11-18T12:03:09+08:00
[INFO] Final Memory: 14M/310M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.
1:testCompile (default-testCompile) on project traprange: Compilation failure
[ERROR] /E:/Repo/traprange-master/src/test/java/com/giaybac/traprange/test/TESTP
DFBox.java:[57,15] 找不到符号
[ERROR] 符号:   方法 sort(<匿名java.util.Comparator<com.google.common.collect.Ra
nge>>)
[ERROR] 位置: 类型为java.util.List<com.google.common.collect.Range<java.lang.Int
eger>>的变量 ranges

I continue to move the project into Eclipse. After I fixed the libraries settings according to the pom.xml and import suggestions, the following code in PDFTableExtractor.java are suggested wrong.

this.textPositions.sort(new Comparator<TextPosition>() {

This appeared in many other java files, e.g. TrapRangeBuilder, and TESTPDFBox. And here is the Eclipse suggestion:

The method sort(new Comparator<Range>(){}) is undefined for the type List<Range<Integer>>

Could you make it clear how you implement the sort method?
Thank you very much.

Win 7 x64
Apache Maven 3.3.3
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.