This is some code somebody sent me:, based on an article at
http://www.planetpdf.com/binthing~WebPageID,47.htm
boolean of_merge_dir (as_dir_name string, as_merge_file_name string)
Boolean b_save
String strFileName, strPath
Integer iNumberOfPagesToInsert,iLastPage
Long l_file
OLEObject AcroExchApp, AcroExchPDDoc,AcroExchInsertPDDoc
lb_dir.DirList(as_dir_name + '\*.pdf', 0)
AcroExchApp = CREATE OLEObject
AcroExchApp.ConnectToNewObject ("AcroExch.App")
AcroExchPDDoc = CREATE OLEObject
AcroExchPDDoc.ConnectToNewObject ("AcroExch.PDDoc")
// Set the directory / folder to use
strPath = trim(as_dir_name)
If strPath <> '' and right(strPath,1) <> '\' Then strPath += '\'
// Open the first file in the directory
AcroExchInsertPDDoc = CREATE OLEObject
AcroExchInsertPDDoc.ConnectToNewObject("AcroExch.PDDoc")
// Start the loop.
For l_file = 1 to lb_dir.TotalItems()
lb_dir.SelectItem(l_file)
strFileName = lb_dir.SelectedItem()
// Get the total pages less one for the last page num [zero based]
AcroExchPDDoc.Open(strPath + strFileName)
iLastPage = AcroExchPDDoc.GetNumPages - 1
// Open the file to insert
AcroExchInsertPDDoc = CREATE OLEObject
AcroExchInsertPDDoc.ConnectToNewObject("AcroExch.PDDoc")
AcroExchInsertPDDoc.Open(strPath + strFileName)
// Get the number of pages to insert
iNumberOfPagesToInsert = AcroExchInsertPDDoc.GetNumPages
// Insert the pages
// skip first one
If l_file > 1 Then
AcroExchPDDoc.InsertPages(iLastPage, AcroExchInsertPDDoc, 0,
iNumberOfPagesToInsert, True )
End If
// Close the document
AcroExchInsertPDDoc.Close
Next
// Save the entire document in new name
AcroExchPDDoc.Save(1,as_merge_file_name)
// Close the PDDoc
AcroExchPDDoc.Close
// Close Acrobat Exchange
AcroExchApp.Exit
Return True
--
Terry Dykstra (TeamSybase)
http://powerbuilder.codeXchange.sybase.com/
http://www.pb9books.com
product enhancement requests:
http://www.isug.com/cgi-bin/ISUG2/submit_enhancement
"Scott Holmberg" <scott.holmbergNOSPAM@randolph.af.mil> wrote in message
news:419506b1$1@forums-2-dub...
> I create PDF files from within my pwoerbuilder program using the SAVEAS
> function.
> I need to append them from inside of another powerbuilder program.
>
> Anybody have any ideas that could help me.
>
> Thanks
> Scott
>
>