Results 1 to 4 of 4

Thread: Merging PDF Files HELP!!!!!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    85

    Question

    I'm creating a program to merge pdf files. My problem right now is that for some reason it is not merging correctly. A lot of time it is only adding the second file to be merged into the new file and not adding the first one at all. This was working and I have not changed the code, so I'm not sure what is happening.

    This is the code that I'm using to do this. I have already opend Acrobat and I have opened the first file:

    ' Get the first pdf file in the directory
    If lstSelectedFiles.ListCount <> 0 Then
    strFileName = lstSelectedFiles.List(n) 'Dir(strPath + PDF_WILDCARD, vbNormal)
    End If

    ' Open the first file in the directory
    AcroExchPDDoc.Open strPath + strFileName

    ' Get the name of the next file in the directory [if any]
    If strFileName <> "" Then
    n = n + 1
    strFileName = lstSelectedFiles.List(n) 'Dir

    ' Start the loop.
    Do While strFileName <> ""
    ' Get the total pages less one for the last page num [zero based]
    iLastPage = AcroExchPDDoc.GetNumPages

    Set AcroExchInsertPDDoc = CreateObject("AcroExch.PDDoc")

    ' Open the file to insert
    AcroExchInsertPDDoc.Open strPath + strFileName

    ' Get the number of pages to insert
    iNumberOfPagesToInsert = AcroExchInsertPDDoc.GetNumPages

    ' Insert the pages
    AcroExchPDDoc.InsertPages iLastPage, AcroExchInsertPDDoc, 0, iNumberOfPagesToInsert, True

    ' Close the document
    AcroExchInsertPDDoc.Close

    ' Get the name of the next file in the directory
    n = n + 1

    strFileName = lstSelectedFiles.List(n) 'dir
    Loop

    ' Save the entire document as the JOIN_FILENAME using SaveFull [0x0001 = &H1]
    AcroExchPDDoc.Save &H1, strPath + "\" + JOIN_FILENAME + ".pdf"

    If you see a mistake please let me know.
    Using VB6 Still Pluging away

  2. #2
    Guest
    aburke ~

    I'm curious... I also use Acrobat and am wondering what you are trying to build? One idea I had was to develop a program which would tie a .pdf file which was delivered via e-mail or download to a singular IP address or PC. In this manner files couldn't be shared by more than the person requesting them. Either by e-mailing. Or by printing the text.

    Adobe has an awfully expensive Add-On to protect files, but I thought it could be possibly be done simpler, using VB.

    This is one reason I'm plodding along learning VB6! Plus I have a few more ideas floating around!




  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    85
    I'm taking 2 or more pdf files and at the end of the first file insert( or merge) the second file to come up with one file. The company that I work for does this a fair bit manually and would like to make it easier for them. This of course is just the first step in the project.
    Using VB6 Still Pluging away

  4. #4
    Guest
    Well you may be interested in this site... http://www.oakworth.demon.co.uk/gymnast.htm Sometimes it takes quite awhile to load for some reason too. You'd think they'd have it down better!

    They have developed a Freeware program based on .pdf. I've downloaded it but haven't unzipped it yet. Some of my other Internet contacts have given it a Thumbs Up!!!

    It may give you some ideas, or the Oakworth group may be able to assist you with your code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width