Dear Hans,

after checking signature fields, such as the one in:

    \nopdfcompression
    \setupinteraction[state=start]
    \setuppapersize[A6, landscape]
    \setuplayout[page]
    \starttext
      \setupfield[sl][horizontal]
        [frame=on, width=1tw, height=1th]
      \definefield[Signature][signature][sl]
      \field[Signature]
    \stoptext

I have found Ulrike’s reply to
https://github.com/latex3/hyperref/issues/335 and the PDF output
validated fine against Arlington.

In short, signature fields may have a widget annotation children, but
the parent should be only a signature field and the child should be only
a widget annotation (not having entries from each other).

Also `/NeedAppearances true` with signature fields cause display (and
probably other) issues with “Acrobat” (so I’m replacing it with
`/SigFlags 1` [the document contains empty signature fields]).

I attach a patch with the commented keys and the extra conditionals to
avoid empty signature fields having `/NeedAppearances true` (providing
`SigFlags 1` instead).

Could you please consider merging it in ConTeXt?

Many thanks for your help,

Pablo
--- mkxl/lpdf-fld.lmt	2025-10-31 22:08:42.939179063 +0100
+++ "lpdf-fld (copy).lmt"	2025-11-05 16:38:24.754558059 +0100
@@ -112,6 +112,7 @@
 local pdf_no_rect             = pdfarray { 0, 0, 0, 0 }
 
 local signature               = nil
+local signature_field         = nil
 
 local splitter = lpeg.splitat("=>")
 
@@ -936,6 +937,8 @@
         end
         if type == "signed" then
             signature = true
+        elseif type == "signature" then
+            signature_field = true
         end
     end
     for name, field in sortedhash(radios) do
@@ -955,10 +958,12 @@
         }
         if signature then
             acroform.SigFlags = 3
+        elseif signature_field then
+			acroform.SigFlags = 1
         elseif pdfmajorversion() == 1 then
             acroform.NeedAppearances = true
         else
-            -- depricated
+            -- deprecated
         end
         if sometext or somefont then
             checkpdfdocencoding()
@@ -1124,18 +1129,19 @@
     local length = tonumber(specification.length or 0) or 0
     local value  = lpdf.registersignature(field.values)
     local d      = pdfdictionary {
-        Subtype  = pdf_widget,
+     -- Subtype  = pdf_widget, -- belongs to widget
         T        = pdfunicode(specification.title),
-        F        = fieldplus(specification),
-        Ff       = fieldflag(specification),
+     -- F        = fieldplus(specification), -- belongs to widget
+        Ff       = fieldflag(specification), -- not required, default value
         OC       = fieldlayer(specification),
         DA       = fieldsurrounding(specification),
         AA       = fieldactions(specification),
         FT       = pdf_sig,
         Q        = fieldalignment(specification),
-        MaxLen   = length == 0 and 1000 or length,
-        DV       = not value and text or nil,
-        V        = value or text,
+     -- MaxLen   = length == 0 and 1000 or length, -- only for text fields
+        MK      = fieldrendering(specification),
+     -- DV       = not value and text or nil, -- not in a signature
+     -- V        = value or text, -- added only when signing
     }
     save_parent(field,specification,d)
 end
@@ -1171,10 +1177,10 @@
         Parent  = pdfreference(parent.pobj),
         F       = fieldplus(specification),
         OC      = fieldlayer(specification),
-        DA      = fieldsurrounding(specification),
+     -- DA      = fieldsurrounding(specification), --belongs to field
         AA      = fieldactions(specification),
         MK      = fieldrendering(specification),
-        Q       = fieldalignment(specification),
+     -- Q       = fieldalignment(specification), --belongs to field
 -- AP = pdfdictionary {
 --     N = pdfreference(lpdf.flushstreamobject("q 0 0 100 100 re f Q"))
 -- }
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to