On 12/18/25 16:14, Hans Hagen via ntg-context wrote:
> On 12/16/2025 5:01 PM, Pablo Rodriguez via ntg-context wrote:
>> On 12/16/25 15:39, Hans Hagen via ntg-context wrote:

>>> i can have a look at the patch but can't test it
>>
>> Testing the patch and complaints are on me.
> 
> ok, so i'll see what is coming once you're ready

I have the first patch with two different dictionaries: a parent
signature (with only entries for that field) and a widget child (with
only entries for that annotation).

I also removed `/NeedAppearances true` with a signature field (not only
when already signed), as we had to do with signed documents.

After discussing it with `poppler` developers, I think there may be
another way of setting the parent and child dictionaries (which
“Acrobat” doesn’t recognize).

First I have to confirm this with the people from the Arlington project
and if (and when) “Acrobat Reader” might improve it, we may have also an
improved fix (but this will take some time).

Many thanks for your help,

Pablo
--- ofld.lmt	2025-12-18 17:47:51.922865345 +0100
+++ mkxl/lpdf-fld.lmt	2025-12-18 18:52:46.357419673 +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,10 @@
         }
         if signature then
             acroform.SigFlags = 3
-        elseif pdfmajorversion() == 1 then
+        elseif pdfmajorversion() == 1 and not signature_field then
             acroform.NeedAppearances = true
         else
-            -- depricated
+            -- deprecated
         end
         if sometext or somefont then
             checkpdfdocencoding()
@@ -1120,22 +1123,23 @@
 -- copy of line ... probably also needs a /Lock
 
 local function makesignatureparent(field,specification)
-    local text   = pdfunicode(field.default)
-    local length = tonumber(specification.length or 0) or 0
-    local value  = lpdf.registersignature(field.values)
+  -- local text   = pdfunicode(field.default) -- not really needed here
+  -- local length = tonumber(specification.length or 0) or 0 -- not really needed here
+  -- local value  = lpdf.registersignature(field.values) -- not really needed here
     local d      = pdfdictionary {
-        Subtype  = pdf_widget,
+     -- Subtype  = pdf_widget,-- belongs to widget, not to field
         T        = pdfunicode(specification.title),
-        F        = fieldplus(specification),
-        Ff       = fieldflag(specification),
+     -- F        = fieldplus(specification), -- belongs to widget, not to field
+        Ff       = fieldflag(specification), -- not required for 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, -- no default signature value
+     -- V        = value or text, -- signature value, when actually signed
     }
     save_parent(field,specification,d)
 end
@@ -1171,10 +1175,10 @@
         Parent  = pdfreference(parent.pobj),
         F       = fieldplus(specification),
         OC      = fieldlayer(specification),
-        DA      = fieldsurrounding(specification),
+     -- DA      = fieldsurrounding(specification), --belongs to field, not widget
         AA      = fieldactions(specification),
         MK      = fieldrendering(specification),
-        Q       = fieldalignment(specification),
+     -- Q       = fieldalignment(specification), --belongs to field, not widget
 -- 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