×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Merge two or more pdf documents into one

Merge two or more pdf documents into one

Merge two or more pdf documents into one

(OP)
Hello All,
    I have a web page where users can select multiple check boxes (where each checkbox is a pdf document link) and i want to be able to merge the selected document into so that i can print multiple copies collately.  I would really appreciate it if someone can provide with the sample code or maybe guide me in the right direction.

thanks,

RE: Merge two or more pdf documents into one

if you have say two saved pdf files, you can combine them together using adobe full version application by
[1] open one pdf file
[2] with adobe select document\insert pages
[3] open the 2nd file
[4] save the current file into a new pdf file

hope this helps

RE: Merge two or more pdf documents into one

(OP)
Hi sncheong,
   thanks for your feedback but i was looking more in terms of merging the two pdf documents using ASP or VB.  I am trying to write a program that will merge two documents that are on the web server and then print them.

Let me know if you have any suggestions for this,

thanks,

RE: Merge two or more pdf documents into one

Hello,
Do you happen to know the ASP code (vbscript) to put a PDF document link on a web page?  I would appreciate it your reply.  Thank you.

RE: Merge two or more pdf documents into one

If you are using VB, references de "Acrobat Type Lybrary" in you project, then add an CAcroApp object, this is the Acrobat application class. Use this Object do open the two files to be merged, in the first document use the method "InsertPages" to add the second file. Now just save the document. For more information go to www.planetpdf.com, they have an VB6 example, it's not complete, but it will be helpful.

RE: Merge two or more pdf documents into one

This information may be of help to some of your questions. Of course its all previous postings so you will have to dig out what you want.  Thre is a October 18, 2000 post entitled "Acrobat Automation is there such a thing", and there is also a Sept 12,2001 post entitled "Merging/Appending Pages to PDF".  

I have been looking for a solution that would also allow me to insert pages programmatically. I find that Adobe allows you do specify a folder of Pdf documents and then it will merge these for you; however the order gets all jumbled up. Our needs require that these documents are inserted in the order that we specify.  I have found some useful information in those documents.  In the meantime, if you know of anything that might be helpful for us, please let me know.

Thanks,

GM

RE: Merge two or more pdf documents into one

Acrobat will insert the pages in the same order that they are selected. (ex. If you select a group of files by dragging a window from right to left, it will insert the files starting with the file that is furthest to the right, and vice versa.)  If you can figure out a way to control what order it selects the files in a folder, then that should solve your problem.

RE: Merge two or more pdf documents into one

Hi amutinu,

If you're still interested...

I was asked to combine two or more PDF files myself recently (prior to E-mailing the resulting PDF).
had to do this quickly (deadline) but it works.

cFiles is just a collection of filenames in the order I want the PDF files to be combined.
You'll have to set a references to the Acrobat Type library but you might already know that.


Private Sub Combine(ByVal cFiles As Collection)
  Dim i As Long
  Dim oPDF As Acrobat.CAcroPDDoc
  Dim oTemp As Acrobat.CAcroPDDoc
  Dim sDir As String
  Dim nPagesTo As Long
  Dim nPagesFrom As Long
  
  On Error GoTo ERRHANDLER
  
  sDir = File1.Path
  If Right$(sDir, 1) <> "\" Then sDir = sDir & "\"
  
  Set oPDF = CreateObject("AcroExch.PDDoc")
  If Not oPDF.Open(sDir & cFiles(1)) Then
    Err.Raise vbObjectError + 1001, "Combine", "Unable to open " & cFiles(1)
  End If
  
  nPagesTo = oPDF.GetNumPages
  
  For i = 2 To cFiles.Count
    Set oTemp = CreateObject("AcroExch.PDDoc")
    If Not oTemp.Open(sDir & cFiles(i)) Then
      Err.Raise vbObjectError + 1001, "Combine", "Unable to open " & cFiles(i)
    End If
    nPagesFrom = oTemp.GetNumPages
    If Not oPDF.InsertPages(nPagesTo - 1, oTemp, 0, nPagesFrom, True) Then
      Err.Raise vbObjectError + 1001, "Combine", "Unable to add " & cFiles(i)
    End If
    nPagesTo = oPDF.GetNumPages
  Next i
  
  If Not oPDF.Save(PDSaveFull, sDir & Text1.Text) Then
    Err.Raise vbObjectError + 1001, "Combine", "Unable to save " & Text1.Text
  End If
  
  Set oPDF = Nothing
  Exit Sub
  
ERRHANDLER:
  MsgBox Err.Description & vbCrLf & _
         Err.Source, vbExclamation
  Set oPDF = Nothing
  Set oTemp = Nothing
End Sub

RE: Merge two or more pdf documents into one

Another approach would be to use AppendPDF or AppendPDF PRO.  These are server products that can help you build the capabilities that you need,  you can find a demo of the application at this URL http://www.appligent.com/newpages/appendpdfpage.html#demo

RE: Merge two or more pdf documents into one

I need to be able to take a dynamically created PDF and append a 10-page PDF to the end of it to be displayed in a browser.

Is this possible in ASP?  Is the full version of Acrobat need to be installed on the web server or is there more that has to be installed for this to work?

Thnaks.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close