Is there any good way to combine two PDF files?

Yes, you can use VeryPDF PDF Toolbox to freely combine two PDF files in different ways. If you have PDF A (containing pages: A1, A2, A3, A4 and A5) and PDF B (containing pages: B1, B2, B3), you can use PDF Toolbox to combine the two PDF files in ways like following:

Merge PDFs in proper order:

  • A1, A2, A3, A4, A5, B1, B2, B3
  • B1, B2, B3, A1, A2, A3, A4, A5

    Merge PDFs in reverse order:

  • A5, A4, A3, A2, A1, B1, B2, B3
  • A1, A2, A3, A4, A5, B3, B2, B1

    Cross merge PDFs

  • A1, B1, A2, B2, A3, B3, A4, A5
  • B1, A1, B2, A2, B3, A3, A4, A5

    The following codes will show you how to combine PDF files in programming languages like ASP.NET, C#, and VB.NET.

    C# code:
    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 + @"\even.pdf"+" B=" + strExePath + @"\odd.pdf -crossmerge A B -outfile " + strExePath + @"\collated.pdf");
             Console.WriteLine(strReturn);
             Console.WriteLine("Please enter any key to continue...");
             Console.ReadKey();
          }
       }
    }

    VB.NET code:   Cross merge PDFs
    Module Module1
        Sub Main()
            Dim p As PDFToolBoxCom.PDFToolBoxCom
            Dim strRet As String
            Dim strParam As String
            Dim strPath As String
            strPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase
    strParam = strPath + "pdftoolbox.exe A=" + strPath + "even.pdf" + " B=" + strPath + "odd.pdf -crossmerge A B -outfile " + strPath + "collated.pdf"
            Console.WriteLine(strParam)
            p = New PDFToolBoxCom.PDFToolBoxCom()
            strRet = p.RunCMD(strParam)
            Console.WriteLine(strRet)
            Console.WriteLine("Please enter any key to continue...")
            Console.ReadKey()
        End Sub
    End
    Module

    VB.NET code:   Merge PDFs in reverse order
    Module Module1
        Sub Main()
            Dim p As PDFToolBoxCom.PDFToolBoxCom
            Dim strRet As String
            Dim strParam As String
            Dim strPath As String
            strPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase
    strParam = strPath + "pdftoolbox.exe A=" + strPath + "even.pdf" + " B=" + strPath + "odd.pdf -crossmerge A Bend-1 -outfile " + strPath + "collated.pdf"
            Console.WriteLine(strParam)
            p = New PDFToolBoxCom.PDFToolBoxCom()
            strRet = p.RunCMD(strParam)
            Console.WriteLine(strRet)
            Console.WriteLine("Please enter any key to continue...")
            Console.ReadKey()
        End Sub
    End
    Module

    ASP_NET code: Cross merge PDFs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    namespace ASP_NET_Call_PDFToolBoxCom
    {
         public partial class _Default : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {}
            protected void Button1_Click(object sender, EventArgs e)
            {
                Console.WriteLine("UserName: {0}", Environment.UserName);
                PDFToolBoxCom.PDFToolBoxCom p = new PDFToolBoxCom.PDFToolBoxCom();
                string strPath = @"E:\bin\pdftoolbox.exe";
                strPath += @" A=even.pdf B=odd.pdf -crossmerge A B -outfile collated.pdf";
                string strRet = p.RunCMD(strPath);
                Response.Write(strRet);
            }
        }
    }

    ASP_NET code:   Merge PDFs in reverse order:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    namespace ASP_NET_Call_PDFToolBoxCom
    {
        public partial class _Default : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {}
            protected void Button1_Click(object sender, EventArgs e)
           {
               Console.WriteLine("UserName: {0}", Environment.UserName);
               PDFToolBoxCom.PDFToolBoxCom p = new PDFToolBoxCom.PDFToolBoxCom();
               string strPath = @"E:\bin\pdftoolbox.exe";
               strPath += @" A=even.pdf B=odd.pdf -crossmerge A Bend-1 -outfile collated.pdf";
               string strRet = p.RunCMD(strPath);
               Response.Write(strRet); 
            }
        }
    }

  • ______________________
    Lear more: VeryPDF PDF Toolbox Component for .NET.

    VN:F [1.9.20_1166]
    Rating: 0.0/10 (0 votes cast)
    VN:F [1.9.20_1166]
    Rating: 0 (from 0 votes)

    Related Posts

    Leave a Reply

    Your email address will not be published. Required fields are marked *


    Verify Code   If you cannot see the CheckCode image,please refresh the page again!