简体   繁体   English

如何获取特定选定区域的 PDF 坐标?

[英]How to get PDF coordinates of specific selected area?

I've a task to compare two pdfs to which I've used the following library:我的任务是比较我使用以下库的两个 pdf:

https://github.com/red6/pdfcompare https://github.com/red6/pdfcompare

The issue is, I've to ignore some parts of pdf and I need coordinates for that.问题是,我必须忽略 pdf 的某些部分,为此我需要坐标。 How do I get the coordinates as mentioned in the documentation?如何获取文档中提到的坐标? I've researched but all the tools used just shows x and y coordinates, I need 4 dimensions here.我研究过,但所有使用的工具只显示 x 和 y 坐标,我在这里需要 4 个维度。

exclusions: [
    {
        page: 2
        x1: 300 // entries without a unit are in pixels. Pdfs are rendered by default at 300DPI
        y1: 1000
        x2: 550
        y2: 1300
    },
    {
        // page is optional. When not given, the exclusion applies to all pages.
        x1: 130.5mm // entries can also be given in units of cm, mm or pt (DTP-Point defined as 1/72 Inches)
        y1: 3.3cm
        x2: 190mm
        y2: 3.7cm
    },
    {
        page: 7
        // coordinates are optional. When not given, the whole page is excluded.
    }
]

I want to ignore the following in a PDF我想忽略 PDF 中的以下内容

pdf中要忽略的区域

Thank you.谢谢你。

Thanks to @Olivier for directing me.感谢@Olivier 指导我。 I used GIMP to load the PDF, and selected the upper left area of the area I want to ignore, and I copied the position. The same I did with lower right.我使用 GIMP 加载了 PDF,并选择了我要忽略的区域的左上角区域,然后复制了 position。我对右下角也做了同样的事情。 Then I pasted the uper-right into x1 and y1, and lower-right into x2 and y2.然后我将右上角粘贴到 x1 和 y1,将右下角粘贴到 x2 和 y2。 Now, it's working as expected.现在,它按预期工作。 Thank you all.谢谢你们。

The attached screenshot showed what I did.随附的屏幕截图显示了我所做的。

upper-left lower-right左上右下

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否有可能获得背景图像上特定区域的坐标? - Is there any possibilities to get coordinates of the specific area on the background image? 如何使用Java从PDF中的特定矩形区域提取数据? - How to extract data from a specific rectangular area in a PDF using Java? 如何将pdf中的图片坐标导入JSONfile? - How can I get Images coordinates in pdf into JSONfile? 如何使用Ice pdf浏览器获取注释的直角坐标 - How to get the rectangular coordinates of the annotation using ice pdf viewer 如何获取 excel 中选定字符串的行、列坐标 - How do i get row,column coordinates on selected String in excel 如何获取在地理编码API Android中选择的区域的周长? - How to get the perimeter of the area selected in geocoding api android? 使用任何适用于Java的pdf api在pdf中查找所选文本的坐标 - Finding the Coordinates of the selected text in a pdf using any pdf api for java Java:如何使用iText从PDF文件中选择区域提取文本? - Java: How to extract text by a selected area from a PDF file using iText? 如何在GWT文本区域的某些特定索引处获取字符 - how to get the charachter at some specific index in GWT Text area 如何从java中的pdf文档中搜索一些特定的字符串或单词以及坐标 - How to search some specific string or a word and there coordinates from a pdf document in java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM