簡體   English   中英

如何使用 java 中的 pdfbox 從 pdf 獲取圖像坐標

[英]How to get image cordinates from pdf using pdfbox in java

我想從現有的 pdf 獲取圖像字段並用其他圖像填充它以使用 java 中的 pdfbox 庫創建新的 pdf 文件

如果您嘗試從 PDF 獲取圖像坐標,您可以嘗試使用 PDF Mantis來提取此信息 - 請參見下面的示例:

// Load your PDF
PdfMantis pdf = new PdfMantis("/home/example.pdf");

// Get the image index
List <ImageIndex> imageIndex = pdf.getImageIndex().buildIndex();

// Iterate over each entry in the index
for (ImageIndex image : imageIndex) {

    // And then we can get coordinates like so...
    image.getX();
    image.getY();
    image.getHeight();
    image.getWidth();
}

免責聲明:我是 PDF Mantis 的開發者。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM