Print the visual representation of a digital signature - #387
Open
AlexanderV wants to merge 1 commit into
Open
Conversation
The widget annotation of a signature field got no /F entry, so its annotation flags are 0. According to 12.5.3 Annotation flags, the print flag must be set for an annotation to be printed: "If clear, never print the annotation, even if it is displayed on screen." The visual representation of a signature was therefore visible on screen, but missing on paper and in every export that prints the pages. Other producers set the flag, e.g. every annotation of the Adobe generated IRS form fw4.pdf has /F 4. The flag is now set when the signature field is created. Hidden and NoView stay clear, so nothing else about the visibility changes. The test needs no certificate, no assets and no network, because it uses a dummy signer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The widget annotation of a signature field gets no
/Fentry, so its annotation flags are0.ISO 32000, 12.5.3 Annotation flags, on the print flag (bit position 3):
So the visual representation of a signature created by PDFsharp is visible on screen, but it is missing on paper and in every export that goes through printing.
Other producers set the flag. In
archives/samples-1.5/PDFs/fw4.pdfof the PDFsharp assets — an Adobe generated IRS form — all 45 annotations carry/F 4.The change
/Fis set toPdfAnnotationFlags.Printwhen the signature field is created.HiddenandNoViewstay clear, so nothing else about the visibility changes. Four lines inDigitalSignatureHandler.GetSignatureField.Test
Pdf.Signatures/SignatureAppearanceTests.cssigns a document, reads it back and checks the flags of the signature field:Printset,HiddenandNoViewclear.The test uses a dummy
IDigitalSigner, so it needs no certificate, no assets and no network, and it runs in milliseconds.Verified on top of current
master: fullPdfSharp.Testssuite green (253 passed, 0 failed).This PR is independent of my other PRs; each of them applies to
masteron its own.