For print billing purposes, we need to collect the page size and use of color for each page of the PDFs pulled into our repository.
With another PDF library that were are abandoning, the only way I could accomplish this was to extract each page to a image and then test the image for the use of color.
Is there a faster way to accomplish this with the PDF Tools sdk?
Test whether a page uses color
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Stefan - PDF-XChange
-
Stefan - PDF-XChange
- Site Admin
- Posts: 19939
- Joined: Mon Jan 12, 2009 8:07 am
Re: Test whether a page uses color
Hello DanDzina,
I am afraid that we don't have any direct or easy to use colour separation tool, and I am not aware of any plans for such to be introduced soon in our SDK products.
Best,
Stefan
Tracker
I am afraid that we don't have any direct or easy to use colour separation tool, and I am not aware of any plans for such to be introduced soon in our SDK products.
Best,
Stefan
Tracker
-
Walter-Tracker Supp
- User
- Posts: 381
- Joined: Mon Jun 13, 2011 5:10 pm
Re: Test whether a page uses color
There is an indirect method that would let you do this with our SDKs which sounds like what you are already doing. You could use the Simple Viewer DLL to render each PDF page to a Windows memory device context (DC), then enumerate the pixels in that DC and test them for colour. You can render to DCs of arbitrary dimensions, so you could test a relatively small rectangular rendering (depending on the type of content you're testing).
However, you can also do it with the Pro SDK, but you must enumerate and test the objects in the PDF (images, text, etc) yourself. If the PDFs only contain raster images and/or regular text, it would not be *too* involved (you can do it with fairly high level library functions), but if there are other types of objects (vector drawings, etc) you may need to start delving into low level PDF structure to enumerate every object.
If you can do this it should be faster than testing a rendering of the page, but the development task is more involved than invoking a hypothetical "DoesPageUseColour()" function because you have to create that function yourself
-Walter
However, you can also do it with the Pro SDK, but you must enumerate and test the objects in the PDF (images, text, etc) yourself. If the PDFs only contain raster images and/or regular text, it would not be *too* involved (you can do it with fairly high level library functions), but if there are other types of objects (vector drawings, etc) you may need to start delving into low level PDF structure to enumerate every object.
If you can do this it should be faster than testing a rendering of the page, but the development task is more involved than invoking a hypothetical "DoesPageUseColour()" function because you have to create that function yourself
-Walter