galkahana / HummusJS

Node.js module for high performance creation, modification and parsing of PDF files and streams
http://www.pdfhummus.com
Other
1.14k stars 169 forks source link

How to add an interactive form? #166

Open mshrfrkw opened 7 years ago

mshrfrkw commented 7 years ago

Hi, Could you tell me how to add an new interactive form to existing pdf? I think it may be possible by adding a field object to the Fields dictionary, but I don't know how to set the position(x, y).

galkahana commented 7 years ago

A completely new interactive form requires building an AcroForm element into the PDF. as there's no high level functionality in hummus of adding forms, you'll have to build it yourself. you'll have to read a little bit about forms in the PDF spec, and use the lower level functions of hummus to add it. If willing, As a starting point i suggest that you'll head to the hummus blog to learn about how to fill forms with hummus. adding a form is just a wee more complex but uses similar elements. see here - http://pdfhummus.com/post/161128437261/a-good-day-to-everyone-today-we-will-discuss-a

apanamaryov commented 4 years ago

Hi, did anybody solve this? Maybe there is some example of how to add fields/check boxes/radio buttons/etc. to existing form in document?