开发者

How can I get the color at a specific coordinate in a pdf file

开发者 https://www.devze.com 2023-02-09 14:36 出处:网络
How can I get the color at a specific coordinate in a pdf file.? Also, I do not know the coordinates. I have only a pdf file. I need to find out a coordinate and its color. I work in java and \"com.lo

How can I get the color at a specific coordinate in a pdf file.? Also, I do not know the coordinates. I have only a pdf file. I need to find out a coordinate and its color. I work in java and "com.lo开发者_运维知识库wagie.text.pdf" package. Please help me.


If you know the page then take the image of the page:

PdfImportedPage page = writer.getImportedPage(reader, pageNum); // get the page of the PDF Image img = Image.getInstance(page); // wrap it in an image object

From there on convert the Image to a byte array and get your color at your coordinate.


I got what I was looking for.

The code is here

Export PDF pages to a series of images in Java

0

精彩评论

暂无评论...
验证码 换一张
取 消