mirror of
https://github.com/documenso/documenso.git
synced 2026-08-23 23:02:22 +10:00
feat(pdf): import AcroForm widgets as Documenso fields on upload
Detect AcroForm widgets (text, checkbox, radio, dropdown, signature) at upload time and reuse their geometry as Documenso fields instead of stripping them via form.flatten(). Imported fields land in the editor as ordinary Field rows assigned to the first signable recipient, removing the manual re-placement step users hit when preparing PDFs in Adobe Acrobat. Extraction runs before normalizePdf so widget geometry is still readable. Text fields go through a name+format heuristic that maps DATE/NUMBER/EMAIL/ NAME/INITIALS/TEXT, with AcroForm /AA format actions taking precedence over name tokens. Coordinates are converted via per-rotation transforms (0/90/180/ 270) against the rendered page dimensions; widgets fully off-page are dropped, partial overlap is clamped. Signed signatures (SignatureField. isSigned()) are detected and skip both the import and the form flatten so the signature stays valid. Encrypted PDFs, XFA hybrids, malformed PDFs, and internal extractor errors all return an empty result with skipReason set so the upload proceeds untouched. Every imported field carries fieldMeta.source = 'acroform' (new optional on ZBaseFieldMeta) for future provenance queries. DOCUMENT envelopes emit a per-field FIELD_CREATED audit entry matching create-envelope-fields.ts. Recipient assignment picks the first Recipient with role SIGNER or APPROVER sorted by (signingOrder asc nulls last, id asc); when no signable recipient exists, a placeholder Recipient 1 SIGNER is created mirroring the placeholder-pipeline behaviour.
This commit is contained in:
@@ -0,0 +1,715 @@
|
||||
%PDF-1.7
|
||||
%âãÏÓ
|
||||
1 0 obj
|
||||
<<
|
||||
/Type /Pages
|
||||
/Kids [4 0 R 5 0 R]
|
||||
/Count 2
|
||||
>>
|
||||
endobj
|
||||
2 0 obj
|
||||
<<
|
||||
/Type /Catalog
|
||||
/Pages 1 0 R
|
||||
/AcroForm 6 0 R
|
||||
>>
|
||||
endobj
|
||||
3 0 obj
|
||||
<<
|
||||
/Title (Untitled)
|
||||
/Author (Unknown)
|
||||
/Creator (@libpdf/core)
|
||||
/Producer (@libpdf/core)
|
||||
/CreationDate (D:20260521033345Z)
|
||||
/ModDate (D:20260521033345Z)
|
||||
>>
|
||||
endobj
|
||||
4 0 obj
|
||||
<<
|
||||
/Type /Page
|
||||
/MediaBox [0 0 612 792]
|
||||
/Resources <<
|
||||
>>
|
||||
/Parent 1 0 R
|
||||
/Annots [8 0 R 11 0 R 14 0 R]
|
||||
>>
|
||||
endobj
|
||||
5 0 obj
|
||||
<<
|
||||
/Type /Page
|
||||
/MediaBox [0 0 612 792]
|
||||
/Resources <<
|
||||
>>
|
||||
/Parent 1 0 R
|
||||
/Annots [18 0 R 21 0 R 24 0 R 27 0 R 31 0 R 34 0 R 37 0 R]
|
||||
>>
|
||||
endobj
|
||||
6 0 obj
|
||||
<<
|
||||
/Fields [7 0 R 10 0 R 13 0 R 17 0 R 20 0 R 30 0 R 33 0 R 36 0 R]
|
||||
/DR <<
|
||||
/Font <<
|
||||
/Helv <<
|
||||
/Type /Font
|
||||
/Subtype /Type1
|
||||
/BaseFont /Helvetica
|
||||
>>
|
||||
/ZaDb <<
|
||||
/Type /Font
|
||||
/Subtype /Type1
|
||||
/BaseFont /ZapfDingbats
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
/DA (/Helv 0 Tf 0 g)
|
||||
/NeedAppearances false
|
||||
/SigFlags 3
|
||||
>>
|
||||
endobj
|
||||
7 0 obj
|
||||
<<
|
||||
/FT /Tx
|
||||
/T (CustomerName)
|
||||
/Kids [8 0 R]
|
||||
/DA (0 g)
|
||||
>>
|
||||
endobj
|
||||
8 0 obj
|
||||
<<
|
||||
/Type /Annot
|
||||
/Subtype /Widget
|
||||
/Rect [80 620 280 644]
|
||||
/P 4 0 R
|
||||
/Parent 7 0 R
|
||||
/F 4
|
||||
/AP <<
|
||||
/N 9 0 R
|
||||
>>
|
||||
>>
|
||||
endobj
|
||||
9 0 obj
|
||||
<<
|
||||
/Length 73/Type /XObject
|
||||
/Subtype /Form
|
||||
/BBox [0 0 200 24]
|
||||
/Resources <<
|
||||
/Font <<
|
||||
/Helv <<
|
||||
/Type /Font
|
||||
/Subtype /Type1
|
||||
/BaseFont /Helvetica
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
stream
|
||||
/Tx BMC
|
||||
q
|
||||
1 1 198 22 re
|
||||
W
|
||||
n
|
||||
BT
|
||||
/Helv 14 Tf
|
||||
0 g
|
||||
2 6.974 Td
|
||||
() Tj
|
||||
ET
|
||||
Q
|
||||
EMC
|
||||
|
||||
endstream
|
||||
endobj
|
||||
10 0 obj
|
||||
<<
|
||||
/FT /Tx
|
||||
/T (signed_date)
|
||||
/Kids [11 0 R]
|
||||
/DA (0 g)
|
||||
>>
|
||||
endobj
|
||||
11 0 obj
|
||||
<<
|
||||
/Type /Annot
|
||||
/Subtype /Widget
|
||||
/Rect [80 560 280 584]
|
||||
/P 4 0 R
|
||||
/Parent 10 0 R
|
||||
/F 4
|
||||
/AP <<
|
||||
/N 12 0 R
|
||||
>>
|
||||
>>
|
||||
endobj
|
||||
12 0 obj
|
||||
<<
|
||||
/Length 73/Type /XObject
|
||||
/Subtype /Form
|
||||
/BBox [0 0 200 24]
|
||||
/Resources <<
|
||||
/Font <<
|
||||
/Helv <<
|
||||
/Type /Font
|
||||
/Subtype /Type1
|
||||
/BaseFont /Helvetica
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
stream
|
||||
/Tx BMC
|
||||
q
|
||||
1 1 198 22 re
|
||||
W
|
||||
n
|
||||
BT
|
||||
/Helv 14 Tf
|
||||
0 g
|
||||
2 6.974 Td
|
||||
() Tj
|
||||
ET
|
||||
Q
|
||||
EMC
|
||||
|
||||
endstream
|
||||
endobj
|
||||
13 0 obj
|
||||
<<
|
||||
/FT /Btn
|
||||
/T (accept_terms)
|
||||
/Kids [14 0 R]
|
||||
/V /Off
|
||||
>>
|
||||
endobj
|
||||
14 0 obj
|
||||
<<
|
||||
/Type /Annot
|
||||
/Subtype /Widget
|
||||
/Rect [80 500 98 518]
|
||||
/P 4 0 R
|
||||
/Parent 13 0 R
|
||||
/F 4
|
||||
/AS /Off
|
||||
/AP <<
|
||||
/N <<
|
||||
/Yes 15 0 R
|
||||
/Off 16 0 R
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
endobj
|
||||
15 0 obj
|
||||
<<
|
||||
/Length 47/Type /XObject
|
||||
/Subtype /Form
|
||||
/BBox [0 0 18 18]
|
||||
/Resources <<
|
||||
/Font <<
|
||||
/ZaDb <<
|
||||
/Type /Font
|
||||
/Subtype /Type1
|
||||
/BaseFont /ZapfDingbats
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
stream
|
||||
q
|
||||
BT
|
||||
/ZaDb 12.6 Tf
|
||||
0 g
|
||||
2.7 4.59 Td
|
||||
(4) Tj
|
||||
ET
|
||||
Q
|
||||
|
||||
endstream
|
||||
endobj
|
||||
16 0 obj
|
||||
<<
|
||||
/Length 0/Type /XObject
|
||||
/Subtype /Form
|
||||
/BBox [0 0 18 18]
|
||||
/Resources <<
|
||||
>>
|
||||
>>
|
||||
stream
|
||||
|
||||
endstream
|
||||
endobj
|
||||
17 0 obj
|
||||
<<
|
||||
/FT /Ch
|
||||
/T (country)
|
||||
/Ff 131072
|
||||
/Kids [18 0 R]
|
||||
/Opt [(USA) (Canada) (Germany)]
|
||||
/DA (0 g)
|
||||
/V (USA)
|
||||
/DV (USA)
|
||||
>>
|
||||
endobj
|
||||
18 0 obj
|
||||
<<
|
||||
/Type /Annot
|
||||
/Subtype /Widget
|
||||
/Rect [80 700 280 724]
|
||||
/P 5 0 R
|
||||
/Parent 17 0 R
|
||||
/F 4
|
||||
/AP <<
|
||||
/N 19 0 R
|
||||
>>
|
||||
>>
|
||||
endobj
|
||||
19 0 obj
|
||||
<<
|
||||
/Length 76/Type /XObject
|
||||
/Subtype /Form
|
||||
/BBox [0 0 200 24]
|
||||
/Resources <<
|
||||
/Font <<
|
||||
/Helv <<
|
||||
/Type /Font
|
||||
/Subtype /Type1
|
||||
/BaseFont /Helvetica
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
stream
|
||||
/Tx BMC
|
||||
q
|
||||
1 1 178 22 re
|
||||
W
|
||||
n
|
||||
BT
|
||||
/Helv 14 Tf
|
||||
0 g
|
||||
2 9.872 Td
|
||||
(USA) Tj
|
||||
ET
|
||||
Q
|
||||
EMC
|
||||
|
||||
endstream
|
||||
endobj
|
||||
20 0 obj
|
||||
<<
|
||||
/FT /Btn
|
||||
/T (payment_method)
|
||||
/Ff 32768
|
||||
/Kids [21 0 R 24 0 R 27 0 R]
|
||||
/V /PayPal
|
||||
/DV /PayPal
|
||||
/Opt [(Credit Card) (PayPal) (Bank Transfer)]
|
||||
>>
|
||||
endobj
|
||||
21 0 obj
|
||||
<<
|
||||
/Type /Annot
|
||||
/Subtype /Widget
|
||||
/Rect [80 640 96 656]
|
||||
/P 5 0 R
|
||||
/Parent 20 0 R
|
||||
/F 4
|
||||
/AS /Off
|
||||
/AP <<
|
||||
/N <<
|
||||
/Credit#20Card 22 0 R
|
||||
/Off 23 0 R
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
endobj
|
||||
22 0 obj
|
||||
<<
|
||||
/Length 46/Type /XObject
|
||||
/Subtype /Form
|
||||
/BBox [0 0 16 16]
|
||||
/Resources <<
|
||||
/Font <<
|
||||
/ZaDb <<
|
||||
/Type /Font
|
||||
/Subtype /Type1
|
||||
/BaseFont /ZapfDingbats
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
stream
|
||||
q
|
||||
BT
|
||||
/ZaDb 9.6 Tf
|
||||
0 g
|
||||
3.2 4.64 Td
|
||||
(l) Tj
|
||||
ET
|
||||
Q
|
||||
|
||||
endstream
|
||||
endobj
|
||||
23 0 obj
|
||||
<<
|
||||
/Length 159/Type /XObject
|
||||
/Subtype /Form
|
||||
/BBox [0 0 16 16]
|
||||
/Resources <<
|
||||
>>
|
||||
>>
|
||||
stream
|
||||
q
|
||||
0 G
|
||||
12.8 8 m
|
||||
12.8 10.65104 10.65104 12.8 8 12.8 c
|
||||
5.34896 12.8 3.2 10.65104 3.2 8 c
|
||||
3.2 5.34896 5.34896 3.2 8 3.2 c
|
||||
10.65104 3.2 12.8 5.34896 12.8 8 c
|
||||
h
|
||||
S
|
||||
Q
|
||||
|
||||
endstream
|
||||
endobj
|
||||
24 0 obj
|
||||
<<
|
||||
/Type /Annot
|
||||
/Subtype /Widget
|
||||
/Rect [80 615 96 631]
|
||||
/P 5 0 R
|
||||
/Parent 20 0 R
|
||||
/F 4
|
||||
/AS /PayPal
|
||||
/AP <<
|
||||
/N <<
|
||||
/PayPal 25 0 R
|
||||
/Off 26 0 R
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
endobj
|
||||
25 0 obj
|
||||
<<
|
||||
/Length 46/Type /XObject
|
||||
/Subtype /Form
|
||||
/BBox [0 0 16 16]
|
||||
/Resources <<
|
||||
/Font <<
|
||||
/ZaDb <<
|
||||
/Type /Font
|
||||
/Subtype /Type1
|
||||
/BaseFont /ZapfDingbats
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
stream
|
||||
q
|
||||
BT
|
||||
/ZaDb 9.6 Tf
|
||||
0 g
|
||||
3.2 4.64 Td
|
||||
(l) Tj
|
||||
ET
|
||||
Q
|
||||
|
||||
endstream
|
||||
endobj
|
||||
26 0 obj
|
||||
<<
|
||||
/Length 159/Type /XObject
|
||||
/Subtype /Form
|
||||
/BBox [0 0 16 16]
|
||||
/Resources <<
|
||||
>>
|
||||
>>
|
||||
stream
|
||||
q
|
||||
0 G
|
||||
12.8 8 m
|
||||
12.8 10.65104 10.65104 12.8 8 12.8 c
|
||||
5.34896 12.8 3.2 10.65104 3.2 8 c
|
||||
3.2 5.34896 5.34896 3.2 8 3.2 c
|
||||
10.65104 3.2 12.8 5.34896 12.8 8 c
|
||||
h
|
||||
S
|
||||
Q
|
||||
|
||||
endstream
|
||||
endobj
|
||||
27 0 obj
|
||||
<<
|
||||
/Type /Annot
|
||||
/Subtype /Widget
|
||||
/Rect [80 590 96 606]
|
||||
/P 5 0 R
|
||||
/Parent 20 0 R
|
||||
/F 4
|
||||
/AS /Off
|
||||
/AP <<
|
||||
/N <<
|
||||
/Bank#20Transfer 28 0 R
|
||||
/Off 29 0 R
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
endobj
|
||||
28 0 obj
|
||||
<<
|
||||
/Length 46/Type /XObject
|
||||
/Subtype /Form
|
||||
/BBox [0 0 16 16]
|
||||
/Resources <<
|
||||
/Font <<
|
||||
/ZaDb <<
|
||||
/Type /Font
|
||||
/Subtype /Type1
|
||||
/BaseFont /ZapfDingbats
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
stream
|
||||
q
|
||||
BT
|
||||
/ZaDb 9.6 Tf
|
||||
0 g
|
||||
3.2 4.64 Td
|
||||
(l) Tj
|
||||
ET
|
||||
Q
|
||||
|
||||
endstream
|
||||
endobj
|
||||
29 0 obj
|
||||
<<
|
||||
/Length 159/Type /XObject
|
||||
/Subtype /Form
|
||||
/BBox [0 0 16 16]
|
||||
/Resources <<
|
||||
>>
|
||||
>>
|
||||
stream
|
||||
q
|
||||
0 G
|
||||
12.8 8 m
|
||||
12.8 10.65104 10.65104 12.8 8 12.8 c
|
||||
5.34896 12.8 3.2 10.65104 3.2 8 c
|
||||
3.2 5.34896 5.34896 3.2 8 3.2 c
|
||||
10.65104 3.2 12.8 5.34896 12.8 8 c
|
||||
h
|
||||
S
|
||||
Q
|
||||
|
||||
endstream
|
||||
endobj
|
||||
30 0 obj
|
||||
<<
|
||||
/FT /Tx
|
||||
/T (initials)
|
||||
/Kids [31 0 R]
|
||||
/DA (0 g)
|
||||
>>
|
||||
endobj
|
||||
31 0 obj
|
||||
<<
|
||||
/Type /Annot
|
||||
/Subtype /Widget
|
||||
/Rect [80 540 140 564]
|
||||
/P 5 0 R
|
||||
/Parent 30 0 R
|
||||
/F 4
|
||||
/AP <<
|
||||
/N 32 0 R
|
||||
>>
|
||||
>>
|
||||
endobj
|
||||
32 0 obj
|
||||
<<
|
||||
/Length 72/Type /XObject
|
||||
/Subtype /Form
|
||||
/BBox [0 0 60 24]
|
||||
/Resources <<
|
||||
/Font <<
|
||||
/Helv <<
|
||||
/Type /Font
|
||||
/Subtype /Type1
|
||||
/BaseFont /Helvetica
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
stream
|
||||
/Tx BMC
|
||||
q
|
||||
1 1 58 22 re
|
||||
W
|
||||
n
|
||||
BT
|
||||
/Helv 14 Tf
|
||||
0 g
|
||||
2 6.974 Td
|
||||
() Tj
|
||||
ET
|
||||
Q
|
||||
EMC
|
||||
|
||||
endstream
|
||||
endobj
|
||||
33 0 obj
|
||||
<<
|
||||
/FT /Tx
|
||||
/T (contact_email)
|
||||
/Kids [34 0 R]
|
||||
/DA (0 g)
|
||||
>>
|
||||
endobj
|
||||
34 0 obj
|
||||
<<
|
||||
/Type /Annot
|
||||
/Subtype /Widget
|
||||
/Rect [160 540 380 564]
|
||||
/P 5 0 R
|
||||
/Parent 33 0 R
|
||||
/F 4
|
||||
/AP <<
|
||||
/N 35 0 R
|
||||
>>
|
||||
>>
|
||||
endobj
|
||||
35 0 obj
|
||||
<<
|
||||
/Length 73/Type /XObject
|
||||
/Subtype /Form
|
||||
/BBox [0 0 220 24]
|
||||
/Resources <<
|
||||
/Font <<
|
||||
/Helv <<
|
||||
/Type /Font
|
||||
/Subtype /Type1
|
||||
/BaseFont /Helvetica
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
stream
|
||||
/Tx BMC
|
||||
q
|
||||
1 1 218 22 re
|
||||
W
|
||||
n
|
||||
BT
|
||||
/Helv 14 Tf
|
||||
0 g
|
||||
2 6.974 Td
|
||||
() Tj
|
||||
ET
|
||||
Q
|
||||
EMC
|
||||
|
||||
endstream
|
||||
endobj
|
||||
36 0 obj
|
||||
<<
|
||||
/FT /Tx
|
||||
/T (item_qty)
|
||||
/Kids [37 0 R]
|
||||
/DA (0 g)
|
||||
/MaxLen 4
|
||||
>>
|
||||
endobj
|
||||
37 0 obj
|
||||
<<
|
||||
/Type /Annot
|
||||
/Subtype /Widget
|
||||
/Rect [400 540 460 564]
|
||||
/P 5 0 R
|
||||
/Parent 36 0 R
|
||||
/F 4
|
||||
/AP <<
|
||||
/N 38 0 R
|
||||
>>
|
||||
>>
|
||||
endobj
|
||||
38 0 obj
|
||||
<<
|
||||
/Length 72/Type /XObject
|
||||
/Subtype /Form
|
||||
/BBox [0 0 60 24]
|
||||
/Resources <<
|
||||
/Font <<
|
||||
/Helv <<
|
||||
/Type /Font
|
||||
/Subtype /Type1
|
||||
/BaseFont /Helvetica
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
>>
|
||||
stream
|
||||
/Tx BMC
|
||||
q
|
||||
1 1 58 22 re
|
||||
W
|
||||
n
|
||||
BT
|
||||
/Helv 14 Tf
|
||||
0 g
|
||||
2 6.974 Td
|
||||
() Tj
|
||||
ET
|
||||
Q
|
||||
EMC
|
||||
|
||||
endstream
|
||||
endobj
|
||||
xref
|
||||
0 39
|
||||
0000000000 65535 f
|
||||
0000000015 00000 n
|
||||
0000000078 00000 n
|
||||
0000000143 00000 n
|
||||
0000000312 00000 n
|
||||
0000000430 00000 n
|
||||
0000000577 00000 n
|
||||
0000000866 00000 n
|
||||
0000000937 00000 n
|
||||
0000001058 00000 n
|
||||
0000001319 00000 n
|
||||
0000001391 00000 n
|
||||
0000001515 00000 n
|
||||
0000001777 00000 n
|
||||
0000001849 00000 n
|
||||
0000002004 00000 n
|
||||
0000002242 00000 n
|
||||
0000002356 00000 n
|
||||
0000002486 00000 n
|
||||
0000002610 00000 n
|
||||
0000002875 00000 n
|
||||
0000003034 00000 n
|
||||
0000003199 00000 n
|
||||
0000003436 00000 n
|
||||
0000003711 00000 n
|
||||
0000003872 00000 n
|
||||
0000004109 00000 n
|
||||
0000004384 00000 n
|
||||
0000004551 00000 n
|
||||
0000004788 00000 n
|
||||
0000005063 00000 n
|
||||
0000005132 00000 n
|
||||
0000005256 00000 n
|
||||
0000005516 00000 n
|
||||
0000005590 00000 n
|
||||
0000005715 00000 n
|
||||
0000005977 00000 n
|
||||
0000006056 00000 n
|
||||
0000006181 00000 n
|
||||
trailer
|
||||
<<
|
||||
/Size 39
|
||||
/Root 2 0 R
|
||||
/Info 3 0 R
|
||||
/ID [<4798EA6ACCB2CE19827C36CD841F759A> <4798EA6ACCB2CE19827C36CD841F759A>]
|
||||
>>
|
||||
startxref
|
||||
6441
|
||||
%%EOF
|
||||
Reference in New Issue
Block a user