The sample codes below demonstrate how you can merge multiple PDF files when one of them is encrypted by an open password or a permissions password. You are strongly recommended to use the powerful tool: VeryPDFToobox.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Call_PDFToolBoxCom
{
class Program
{
static void Main(string[] args)
{
string strExePath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
PDFToolBoxCom.PDFToolBoxCom p = new PDFToolBoxCom.PDFToolBoxCom();
string strReturn = p.RunCMD(@"A="+ strExePath + @"\secured.pdf "+ strExePath + @"\2.pdf -inputpassword A=foopass -merge -outfile "+ strExePath + @"\3.pdf");
Console.WriteLine(strReturn);
Console.WriteLine("Please enter any key to continue...");
Console.ReadKey();
}
}
}
Lear more about VeryPDF PDF Toolbox Component for .NET.