Quantcast
Channel: Adobe Community : Unanswered Discussions - Acrobat
Viewing all articles
Browse latest Browse all 73766

How to Merge Multiple PDF's

$
0
0

HI Forum

 

I am a newbie to both Acrobat and VB,

Basically a perl Developer,

 

I have created a application to Merge multiple PDF's into a Single PDF, but the problem I am facing is some pages are missed during Merging

 

For Example

 

I have 4 pdf's (1.pdf, 2.pdf, 3.pdf, 4.pdf), each PDF has 2 pages, totally 8 pages,

 

When i merge using my application, it is getting collapsed and then merged

 

Here is my Code

 

<code>

Imports System.IO

Imports Acrobat

 

Public Class Form1

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        MergePDF()

    End Sub

 

    Sub MergePDF()

 

        Dim gPDDoc1 As AcroPDDoc

        Dim gPDDoc2 As AcroPDDoc

        Dim gPDDoc3 As AcroPDDoc

        Dim gPDDoc4 As AcroPDDoc

 

        gPDDoc1 = CreateObject("AcroExch.PDDoc")

        gPDDoc2 = CreateObject("AcroExch.PDDoc")

        gPDDoc3 = CreateObject("AcroExch.PDDoc")

        gPDDoc4 = CreateObject("AcroExch.PDDoc")

 

        Dim chk1 = gPDDoc1.Open("D:\sathish\1.pdf")

        Dim chk2 = gPDDoc2.Open("D:\sathish\2.pdf")

        Dim chk3 = gPDDoc3.Open("D:\sathish\3.pdf")

        Dim chk4 = gPDDoc4.Open("D:\sathish\4.pdf")

 

        Dim mergefile As Boolean

        Dim numpg1, numpg2, numpg3, numpg4

        numpg1 = gPDDoc1.GetNumPages()

        numpg2 = gPDDoc2.GetNumPages()

        numpg3 = gPDDoc3.GetNumPages()

        numpg4 = gPDDoc4.GetNumPages()

 

        MsgBox(numpg1 & numpg2 & numpg3 & numpg4)

 

        mergefile = gPDDoc1.InsertPages(numpg1 - 1, gPDDoc2, 0, 1, 0)

        mergefile = gPDDoc1.InsertPages(numpg2 - 1, gPDDoc3, 0, 1, 0)

        mergefile = gPDDoc1.InsertPages(numpg3 - 1, gPDDoc4, 0, 1, 0)

 

 

        Dim savemergefile As Boolean

        savemergefile = gPDDoc1.Save(1, "D:\sathish\merged.pdf")

 

    End Sub

 

 

End Class

</code>

 

I Dont know how to give the correct page end to merge,

 

Thanks in Advance for your Kind replies,

 

Thanks & Regards

Sathish V.


Viewing all articles
Browse latest Browse all 73766

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>