Open JasonGross opened 4 years ago
You can avoid the question if the pdf should be saved by setting NeedAppearance=false in the form options. Beside this, yes the checkbox is faulty. But correcting it is not done by some simple change, and so has currently the status long term. Consider to use acrotex if you need working checkboxes directly.
I think you mean NeedAppearances=false
, right? (I get an error on NeedAppearance
.) But indeed this makes reader not ask about saving the file. Can you explain this? The manual mentions this option only in documenting the pdfa
option, and does not say anything other than "Because of this, hyperref’s implementation of Forms looks ugly".
Consider to use acrotex if you need working checkboxes directly.
If I understand correctly, this amounts to using the eforms
package, yes? I get exactly the same behavior with this file:
\documentclass{article}
\usepackage{hyperref}
\usepackage{eforms}
\begin{document}
\fbox{\checkBox[\V{Yes}]{foo}{\baselineskip}{\baselineskip}{Yes}}
\end{document}
so this problem seems to occur in acrotex as well as hyperref.
Additional interesting note: clicking on the checkbox in Chrome does not check it, but does change the border thickness:
The implementation in hyperref will probably not change, but there is a new implementation of checkboxes in the pdfmanagement-testphase bundle. It uses correct appearances both for the Yes and the Off state. You could try if it works better. Documentation is in l3pdffield.pdf and l3pdffield-checkbox.pdf.
\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{uncompress,pdfversion=2.0}
\documentclass[]{article}
\usepackage{hyperref}
\usepackage{l3pdffield-testphase}
\begin{document}
Test checkbox:
\ExplSyntaxOn
\pdffield_checkbox:n{name=test,checked}
\ExplSyntaxOff
\end{document}
I have
This checkbox shows up fine in Adobe Reader, but the checkbox is unchecked in Chrome's PDF viewer, and does not show up at all in Firefox's PDF viewer nor in SumatraPDF. Worse, if I run
pdf2ps foo.pdf foo.ps
and then runps2pdf foo.ps foo-ps.pdf
, the resulting PDF file does not contain a checkbox. Note thatpdf2ps
warns withNote also that when I open the original PDF in Adobe Reader, when I go to close it, Adobe Reader asks me if I want to save changes, suggesting that it's corrected some invalidity in the pdf behind the scenes. Indeed, if I do this, the resulting PDF displays checkboxes correctly in all PDF viewers, and displays the checkbox when I round-trip through a .ps file.
Here are all the generated files: Assuming I named the above
foo.tex
, then:pdflatex foo.tex
gives foo.log and foo.pdffoo.pdf
:Running
pdf2ps foo.pdf foo.ps; tar -czf foo.ps.tar.gz foo.ps; ps2pdf foo.ps foo-ps.pdf
gives foo.ps.tar.gz and foo-ps.pdf and on the command line says