Merging Password Protected PDFs

Merging Password Protected PDFs

Forum member · Nov 19, 2009
Here is some background: writing an app that creates pdfs from data in a database, merges it with uploaded files from same database. All is fine until a pdf that is encrypted/password protected is encountered. the Append method of the MergeDocument instance throws the exception: 11/19/2009 3:36:43 PM Document can not be decrypted. Invalid owner password. ceTe.DynamicPDF.35 at ceTe.DynamicPDF.Merger.PdfDocument.g() at ceTe.DynamicPDF.Merger.PdfDocument..ctor(c0 A_0, String A_1) at ceTe.DynamicPDF.Merger.PdfDocument..ctor(String filePath) at ceTe.DynamicPDF.Merger.MergeDocument.Append(String filePath) at refrecToPDF.Form1.convert(DataTable dt) in D:\stuff\refrecToPDF\refrecToPDF\Form1.cs:line 271 at refrecToPDF.Form1.but_go_Click(Object sender, EventArgs e) in D:\stuff\refrecToPDF\refrecToPDF\Form1.cs:line 56 the code is as follows: MergeDocument test = new MergeDocument(); test.PdfVersion = PdfVersion.v1_7; foreach (string zz in fileList) { test.Append(zz); } if (test.Pages.Count > 0) { finalPDF = test.Draw(); } I have used other pdf merging utilities and they merged just fine but did not support pdf spec 1.5+. This is a must have for me since the files Im merging are letters of recommendation to a number of graduate programs at a university, which is why we get so many pdfs that are password protected. Any help would be greatly appreciated. Thanks, jimm

Re: Merging Password Protected PDFs

Support · Nov 20, 2009
Hello jimm , You will have to to provide the password when merging the a PDF which is password protected. It is not possible to merge/edit the PDF document without password. You will have to use the PdfDocument object for providing the password. The Append method also will take the PdfDocument object as a parameter. Below is a sample code for this. PdfDocument pdf = new PdfDocument( filePath, password ); document.Append( pdf ); Thanks, ceTe Software Support Team.