Sunday, 15 July 2012

PoDoFoColor Lua Scripting

sdaau wrote in with some news about podofocolor, I'd like to share:

I just found about podofocolor on - and I got really interested in "Analyzing colors - Find out, which colorspaces or colors are used in a PDF". I couldn't find an example of how to do that on that page, and I assumed the only way to do is through Lua.

Unfortunately, while there are some PPA builds for Ubuntu ( see ), those do not have Lua built-in, so I rebuilt podofo and utils on Lucid, and posted the executables here - since they are statically linked, they may be useful to others as well:

I have also recorded the steps to building those executables in

The above directory also contains a modification of the example.lua script:

... which can be used to simply print out any color encountered in a PDF, by using this command line:

$ ./libpodofo-utils-lucid/podofocolor lua example-colorlist.lua /path/to/mytest.pdf /dev/null

<]/Info 2 0 R/Root 1 0 R/Size 16>>
Processing page 1...
-> Lua is parsing page: 1
Reading object 6 0 R with type: Number
set_non_stroking_color_gray: 1
set_non_stroking_color_cmyk: 0.233887 1 1 0.218994

Note that it is important to add `/dev/null` as output file - otherwise, both the color report _and the pdf in its entirety_ will be dumped to the terminal - making the report about colors impossible to read.

I would have appreciated a lot a similar guide/explanation on the blogspot webpage (or in a help/readme); and I'd be very happy if some of this here can contribute towards more detailed examples in then documentation.

Many thanks for the great software,

The original post can be found here:
If you also have interesting PoDoFo stuff to share, feel free to drop me a mail.

1 comment:

lingjie shi said...

I accidentally viewed your blog and I was so amazed with your work that it touched the deepness of my heart and it made me sentimental. Thanks for posting. Visit my site to buy fake watches uk small sizes