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

Appended / embedded AcroForms of PDF files are missing #260

Closed nknickrehm closed 6 years ago

nknickrehm commented 6 years ago

Hi, I am writing an application for my bachelor thesis that inserts data collected by web forms into official PDF files from my university. There are some cases where you need to fill out more than one document so I want to append these files dynamically if needed. To fill out the form I use the pdf-form-fill.js from your website which works quite well for the main PDF file, but the AcroForm Object of all PDF files I append to it are removed. I've also tried creating new pages in the original PDF and embedding the other files pages but this does't help either. If I exclude the fillForm(...) and just append the PDF files the AcroForms are also missing.

Here are the relevant parts of my code

const writer = hummus.createWriterToModify( new hummus.PDFRStreamForFile(sourcePDF), new hummus.PDFStreamForResponse(res) );

// ...

pdfFiles.forEach(file => { // checked if conditions for this file apply writer.appendPDFPagesFromPDF(file.path); });

// ...

fillForm(writer, data, () => { writer.end(); res.end(); }); Thanks for the help and this awesome library!

nknickrehm commented 6 years ago

187 Sorry did not see this issue which completely solves my problem