Java 如何在TABLA命令行中指定列坐标

Java 如何在TABLA命令行中指定列坐标,java,tabula,Java,Tabula,我需要PDF中的表格数据,我正在使用下面的命令来获取表格数据 java -jar tabula-java.jar -a 301.95,14.85,841.0500000000001,695.25 -t example.pdf 但在这种情况下,两列数据在某些行中混合, 所以我想指定列坐标,以获得完美的数据, 但我不知道如何获得柱坐标, 因此,任何人都可以用完美的命令来指导我,这会很有帮助 提前谢谢 可以使用-c或--columns参数指定列坐标。指定的坐标将是柱之间轮廓线的坐标。因此,如果一列从

我需要PDF中的表格数据,我正在使用下面的命令来获取表格数据

java -jar tabula-java.jar -a 301.95,14.85,841.0500000000001,695.25 -t example.pdf
但在这种情况下,两列数据在某些行中混合, 所以我想指定列坐标,以获得完美的数据, 但我不知道如何获得柱坐标, 因此,任何人都可以用完美的命令来指导我,这会很有帮助


提前谢谢

可以使用-c或--columns参数指定列坐标。指定的坐标将是柱之间轮廓线的坐标。因此,如果一列从10.5到13.5,下一列从13.5到17.5,那么您只列出13.5。您还需要关闭“猜测”。您没有提供示例pdf,因此我无法为您提供正确的坐标,但您的命令如下所示:

java -jar tabula-java.jar -a 301.95,14.85,841.0500000000001,695.25 -c 15.7,17.3,19.2,33.2,70.1,100.7,200.6,300.7 -t example.pdf -g False
您可以从“帮助”命令中了解有关正确获取命令的不同选项的更多信息:

    $ java -jar target/tabula-1.0.1-jar-with-dependencies.jar --help
usage: tabula [-a <AREA>] [-b <DIRECTORY>] [-c <COLUMNS>] [-d] [-f
       <FORMAT>] [-g] [-h] [-i] [-l] [-n] [-o <OUTFILE>] [-p <PAGES>] [-r]
       [-s <PASSWORD>] [-t] [-u] [-v]

Tabula helps you extract tables from PDFs

 -a,--area <AREA>           Portion of the page to analyze
                            (top,left,bottom,right). Example: --area
                            269.875,12.75,790.5,561. Default is entire
                            page
 -b,--batch <DIRECTORY>     Convert all .pdfs in the provided directory.
 -c,--columns <COLUMNS>     X coordinates of column boundaries. Example
                            --columns 10.1,20.2,30.3
 -d,--debug                 Print detected table areas instead of
                            processing.
 -f,--format <FORMAT>       Output format: (CSV,TSV,JSON). Default: CSV
 -g,--guess                 Guess the portion of the page to analyze per
                            page.
 -h,--help                  Print this help text.
 -i,--silent                Suppress all stderr output.
 -l,--lattice               Force PDF to be extracted using lattice-mode
                            extraction (if there are ruling lines
                            separating each cell, as in a PDF of an Excel
                            spreadsheet)
 -n,--no-spreadsheet        [Deprecated in favor of -t/--stream] Force PDF
                            not to be extracted using spreadsheet-style
                            extraction (if there are no ruling lines
                            separating each cell)
 -o,--outfile <OUTFILE>     Write output to <file> instead of STDOUT.
                            Default: -
 -p,--pages <PAGES>         Comma separated list of ranges, or all.
                            Examples: --pages 1-3,5-7, --pages 3 or
                            --pages all. Default is --pages 1
 -r,--spreadsheet           [Deprecated in favor of -l/--lattice] Force
                            PDF to be extracted using spreadsheet-style
                            extraction (if there are ruling lines
                            separating each cell, as in a PDF of an Excel
                            spreadsheet)
 -s,--password <PASSWORD>   Password to decrypt document. Default is empty
 -t,--stream                Force PDF to be extracted using stream-mode
                            extraction (if there are no ruling lines
                            separating each cell)
 -u,--use-line-returns      Use embedded line returns in cells. (Only in
                            spreadsheet mode.)
 -v,--version               Print version and exit.
$java-jar-target/tabla-1.0.1-jar-with-dependencies.jar——帮助
用法:表格[-a][b][c][d][f
][g][h][i][l][n][o][p][r]
[s][t][u][v]
tabla帮助您从PDF中提取表格
-a、 --要分析的页面区域部分
(上、左、下、右)。示例:--区域
269.875,12.75,790.5,561. 默认值是完整的
页
-b、 --批转换提供目录中的所有.pdfs。
-c、 --柱X柱边界坐标。例子
--第10.1、20.2、30.3列
-d、 --调试打印检测到的表区域,而不是
处理。
-f、 --格式输出格式:(CSV、TSV、JSON)。默认值:CSV
-g、 --根据猜测页面要分析的部分
页
-h、 --帮助打印此帮助文本。
-i、 --静默抑制所有stderr输出。
-l、 --使用晶格模式提取的晶格力PDF
提取(如果有刻线)
分隔每个单元格,如在Excel的PDF中
电子表格)
-n、 --无电子表格[不赞成使用-t/--stream]强制PDF
不使用电子表格样式提取
提取(如果没有刻线
分离每个单元)
-o、 --将文件写入输出,而不是标准输出。
默认值:-
-p、 --页面以逗号分隔的范围列表,或全部。
示例:--第1-3页、第5-7页、--第3页或
--所有页面。默认值为--pages1
-r、 --电子表格[反对使用-l/--lattice]强制
要使用电子表格样式提取的PDF
提取(如果有刻线)
分隔每个单元格,如在Excel的PDF中
电子表格)
-s、 --用于解密文档的密码。默认值为空
-t、 --使用流模式提取的流强制PDF
提取(如果没有刻线
分离每个单元)
-u、 --使用换行符使用单元格中的嵌入换行符。(只有在
电子表格模式。)
-v、 --版本打印版本并退出。

能否详细说明列的单位(像素?)以及从文档中获取列大小的实用方法?谢谢纯属轶事,但我认为测量值代表像素(@72dpi)。通过使用和导出模板,可以获得快速测量。请参考导出的json中的维度。^^我是如何得出这则轶事的^^:如果您查看许多Git问题,他们提到的数字指的是“pt”。这意味着任意测量的一个“点”。通常,在72ppi时,1pt==1px要确定输入区域或列的正确间距,请在Adobe Acrobat中打开pdf,打开标尺,然后将其设置为点。放大视图,您可以看到要拆分区域/表格的精确点测量值。