How can I get the color at a specific coordinate in a pdf file
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
精彩评论