Skip to main content
Participant
March 2, 2016
Question

Merging PDF Files in ASP.NET

  • March 2, 2016
  • 0 replies
  • 383 views

I am using C# and asp.net

I have the following code to combine two PDF files.

This runs in debug mode. But it does not from the web client. What do I need to do to make this work? Thanks much in advance.

                String filePath = GlobalVar.excelSavedFilePath;

                inFileName  =  "input.pdf";

                appendFileName = "append.pdf";

                DirectoryInfo dirInfo = new DirectoryInfo(GlobalVar.excelSavedFilePath);

                outFileName = GlobalVar.excelSavedFilePath + "out1.pdf";

                Type AcrobatPDDocType;

                AcrobatPDDocType = Type.GetTypeFromProgID("AcroExch.PDDoc");

                Acrobat.CAcroPDDoc src = (Acrobat.CAcroPDDoc)Activator.CreateInstance(AcrobatPDDocType);

                Acrobat.CAcroPDDoc dest = (Acrobat.CAcroPDDoc)Activator.CreateInstance(AcrobatPDDocType);

                src.Open(filePath + inFileName);

                dest.Open(filePath + appendFileName);

                src.InsertPages(src.GetNumPages() - 1, dest, 0, dest.GetNumPages(), 0);

                src.Save(1, outFileName);

                src.Close();

                dest.Close();

                msg = "Merged";

                return msg;

This topic has been closed for replies.