java - pdfbox merge pdf with form -



java - pdfbox merge pdf with form -

i have simple pdf file (a.pdf) , pdf file forms in (checkboxes, textfields, ...). want merge them:

public void merge () throws ioexception, cosvisitorexception, cryptographyexception, invalidpasswordexception { pdfmergerutility merger = new pdfmergerutility(); pddocument arg0 = pddocument.load("c:\\users\\...\\desktop\\a.pdf"); pddocument arg1 = pddocument.load("c:\\users\\...\\desktop\\b.pdf"); if (arg1.isencrypted()) { arg1.decrypt("consol"); arg1.setallsecuritytoberemoved(true); } merger.appenddocument(arg0, arg1); arg0.save("c:\\users\\...\\desktop\\xout.pdf"); arg0.close(); arg1.close(); }

this works forms not included in target pdf file anymore. have hints me?

try out :

try { pdfmergerutility mpdf = new pdfmergerutility(); string folder = "c:/users/.../desktop"; string destinationfilename = "output.pdf"; //say file folderfile = new file(folder); if (folderfile.isdirectory()) { mpdf.addsource(folder + "/" + "a.pdf"); mpdf.addsource(folder+ "/"+"b.pdf"); mpdf.setdestinationfilename(folder + "/"+ destinationfilename); mpdf.mergedocuments(); } catch(exception ex) { logger.error(ex); }

hope, help....

java pdf pdfbox

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -