I'm working on a program that generates interactive forms in PDF. I'd like to add a checkbox on the page but there is problem. When the checbox has focus, everything works ok. When the focus is out, the checbox loses its appearance and it is rendered in default graphics (that's incorrect for me).
You can see the problem here: http://home.zcu.cz/~struharv/000003-checkbox.pdf (it's a handmade pdf file to be easily readable). In chrome build-in viewer it works ok, but not in Acrobat.
I don't see what's wrong.
Thanks for your help.
%PDF-1.7 1 0 obj << % entry point /Type /Catalog /AcroForm << /DR 3 0 R /Fields [101 0 R] >> /Pages 2 0 R >> endobj 2 0 obj << % Pages object /Type /Pages /MediaBox [0 0 200 200] /Count 1 /Kids [ << % Page /Type /Page /Parent 2 0 R /Resources 3 0 R /Annots [101 0 R] /Contents 5 0 R >> ] >> endobj 101 0 obj << /Type /Annot /Subtype /Widget /Rect [70 50 120 70] /AP << /N << /Yes 108 0 R /Off 109 0 R >> >> /AS /Yes /V /Yes /FT /Btn /T (checkbox1) >> endobj 108 0 obj << /Type /XObject /Subtype /Form /BBox [0 0 50 20] /Resources 3 0 R >> stream 0 0 50 20 re 0.8 g f BT /F1 12 Tf 0 g 7 5.908 Td (checked) Tj ET endstream endobj 109 0 obj << /Type /XObject /Subtype /Form /BBox [0 0 50 20] /Resources 3 0 R >> stream 0 0 50 20 re 0.6 g B BT /F1 12 Tf 0 g 7 5.908 Td (unchecked) Tj ET endstream endobj 3 0 obj << % Resources /Font << /F1 4 0 R >> >> endobj 4 0 obj << % Font /Type /Font /Subtype /Type1 /BaseFont /Times-Roman >> endobj 5 0 obj << % page content >> stream BT 70 150 TD /F1 12 Tf (Hello, world!) Tj ET endstream endobj trailer << /Root 1 0 R >> %%EOF
Depending on how you look at this – it's either a bug or a feature…
Acrobat/Reader have a feature (been there since Acrobat/Reader 6, IIRC) where they will "Highlight form fields" to show users which things on the page are real fields and which are simply text. This is on by default, though can be turned off in Preferences. Additionally, when the Form Message Bar (the purple thing) is present on a more complex form (than your one check box), the user can toggle it on/off easily.
The highlight feature doesn't respect custom appearances, which is why you are seeing the normal one until you click.
Thank you very much.
When it is switched off, it works as expected. Now I'm wondering how I can cope with it. Forms generated in Acrobat Pro or Open Office seem to be rendered good without switching off the feature.