Following up – I followed the code in the second link (github version here
<https://github.com/mkl-public/testarea-pdfbox2/blob/master/src/test/java/mkl/testarea/pdfbox2/form/CreateCheckBox.java>)
and wrote a slightly modified version of that worked. It looked like not
setting the appearance streams was the issue.

On Tue, Dec 10, 2019 at 9:52 AM Jesse Zhou <jesse.z...@gusto.com> wrote:

> Hello,
>
> I have a question about how pdf checkboxes work that I'm hoping someone
> smarter than me can help explain. I have a PDF, in which I've added
> checkboxes with an empty "down" appearance stream, but no other appearance
> streams. The normal appearance stream is absent from these checkboxes.
>
> I've programmatically "checked" the checkboxes using PDFBox, and even
> though the values are changed in the PDF internally, the PDF viewers that
> I've used (Preview on macOS and Adobe Acrobat, Google Chrome's built-in
> viewer) don't show the box as "checked".
>
> I'm guessing that it's because I haven't set the appearance stream. Is
> this correct?
>
> Curiously though, the PDF Viewers will "check" the box if I click on them
> while viewing them. If it is because of the appearance streams, generally
> speaking, do PDF Viewers have a smart way of handling if an appearance
> stream is absent?
>
> Looking for any guidance / direction. Here are some resources I've already
> checked out.
>
> -
> https://stackoverflow.com/questions/43343232/how-to-add-a-border-to-a-checkbox-and-make-it-always-visible
> -
> https://stackoverflow.com/questions/43604973/creating-a-checkbox-and-printing-it-to-pdf-file-is-not-working-using-pdfbox-1-8/43606762
>
> Thanks in advance!
> -Jesse
>


-- 

*Jesse Zhou*

Engineering | Employee Lifecycle | 408-504-6225

Gusto | The people platform built for small businesses

Jesse works with Gusto

Reply via email to