You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Andrew Munn <an...@nmedia.net> on 2015/03/14 06:56:32 UTC

parsing checkbox state in flat PDF form?

I have checkboxes and radio buttons in forms that are flat.  The boxes can 
sometimes be fully filled in (solid black) or sometimes what appears to be 
a vector drawn x extending to all 4 corners.

My question is similar to this one from over 2 years ago.

https://www.mail-archive.com/users@pdfbox.apache.org/msg02139.html

I need to programatically determine the state of these check boxes.  I'm 
processing the same forms frequently so I could do something like:

BufferedImage src = pdfRenderer.renderImageWithDPI(1, 600, ImageType.GRAY); 
BufferedImage boxImage = src.getSubimage(234,345,10,10); 

...and then check the color of the pixels in the box to see if it's 
"checked" or not.  But is there a better way?

Thanks,
Andrew




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: parsing checkbox state in flat PDF form?

Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
dependent on the PDF content you might also be able to inspect the graphics commands using PDFStreamEngine or PDFGraphicsStreamEngine

BR
Maruan

> Am 14.03.2015 um 06:56 schrieb Andrew Munn <an...@nmedia.net>:
> 
> I have checkboxes and radio buttons in forms that are flat.  The boxes can 
> sometimes be fully filled in (solid black) or sometimes what appears to be 
> a vector drawn x extending to all 4 corners.
> 
> My question is similar to this one from over 2 years ago.
> 
> https://www.mail-archive.com/users@pdfbox.apache.org/msg02139.html
> 
> I need to programatically determine the state of these check boxes.  I'm 
> processing the same forms frequently so I could do something like:
> 
> BufferedImage src = pdfRenderer.renderImageWithDPI(1, 600, ImageType.GRAY); 
> BufferedImage boxImage = src.getSubimage(234,345,10,10); 
> 
> ...and then check the color of the pixels in the box to see if it's 
> "checked" or not.  But is there a better way?
> 
> Thanks,
> Andrew
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>