Is there any way that I can detect color pages in a PDF file?For example I have a PDF file with 5 pages, and the first and last page are in color. How can I detect the color pages? Can iText do it?Now my solution is to convert PDF to images and then detect images color or black&white, but it takes too long time to do it, I need a fast way.Convert pdf to image by Adobe Acrobat Code as fellows
}
Feb 17, 2012 PDF supports 11 different ways to represent colors - Gray, RGB, CMYK, Spot, etc. How would you categorize these in your definition? You need to first determine exactly what your rules for 'color vs. Not color' are and then you can write the code you need. When you print a color PDF, all of the colors used in the file print on one plate. This process is called composite printing.The options available in the Output panel of the Advanced Print Setup dialog box depend on the selected printer. Artwork that will be commercially reproduced and that contains more than a single color must be printed on separate master plates, one for each color.
}}
steive
steivesteive
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Browse other questions tagged itext or ask your own question.
Is there any way, in Python, of automatically detect the colors in a certain area of a PDF and either translate them to RGB or compare them to the legend and then get the color?
SilvioSilvio
2 Answers
Depending on where you want to extract the information from, you can use
minecart
. It has really robust support for colors and allows easy conversion to RGB. Though you can't input a coordinate and get the color value there, if you are trying to get color information from a shape you could do something like the following:[Disclaimer: I'm the author of
FelipeFelipeminecart
]1,88211 gold badge1616 silver badges3535 bronze badges
Felipe's approach didn't work for me, but I came up with this:
This will print a neat list of all unique RGB values in the first page of your document (you could extend it to all pages, of course).
Community♦
黄雨伞黄雨伞