PDFBox PDFTextStripperByArea 区域坐标
中的矩形的尺寸和方向是多少
PDFTextStripperByArea
函数addRegion(StringregionName, Rectangle2D rect)
。换句话说,矩形R从哪里开始以及它有多大(原点值的尺寸,矩形的尺寸)以及它的方向go(图中蓝色箭头的方向),如果将 new Rectangle(10,10,100,100)
作为第二个参数给出?
In what dimensions and direction is the Rectangle in the
PDFTextStripperByArea
's function addRegion(String regionName, Rectangle2D rect)
.
In other words, where does the rectangle R start and how big is it (dimensions of the origin values, dimensions of the rectangle) and in what direction does it go (direction of the blue arrows in illustration), if new Rectangle(10,10,100,100)
is given as a second parameter?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
表示矩形的左上角位于 (10, 10) 位置,即距离 PDF 文档左侧和顶部 10 个单位。这里的“单位”是 1 pt = 1/72 英寸。
第一个 100 表示矩形的宽度,第二个 100 表示矩形的高度。
总结一下,右图是第一张。
我编写了这段代码来提取作为函数参数给出的页面的某些区域:
因此,x 和 y 是矩形左上角的绝对坐标,然后指定其宽度和高度。 page 是作为该函数的参数给出的 PDPage 变量。
means that the rectangle will have its upper-left corner at position (10, 10), so 10 units far from the left and the top of the PDF document. Here a "unit" is 1 pt = 1/72 inch.
The first 100 represents the width of the rectangle and the second one its height.
To sum up, the right picture is the first one.
I wrote this code to extract some areas of a page given as arguments to the function:
So, x and y are the absolute coordinates of the upper-left corner of the Rectangle and then you specify its width and height. page is a PDPage variable given as argument to this function.
正在考虑做这样的事情,所以我想我会传递我发现的东西。
这是使用 itext 创建原始 pdf 的代码。
如果您打开 PDF,您会在左上角看到文本。这是显示您正在寻找的内容的测试。
位置 (0, 0) 是文档的左上角。宽度和高度向下和向右。我能够将范围稍微缩小到 (35, 52, 120, 3),但仍然可以通过测试。
所有代码都是用groovy 编写的。
Was looking into doing something like this, so I thought I'd pass what I found along.
Here's the code for creating my original pdf using itext.
If you crack open the pdf, you'll see the text in the upper left hand corner. Here's the test showing what you are looking for.
Position (0, 0) is the upper left hand corner of the document. The width and height are heading down and to the right. I was able to trim down the range a bit to (35, 52, 120, 3) and still get the test to pass.
All code is written in groovy.