mozart90 Posted November 13, 2006 Share Posted November 13, 2006 Hi I wrote the following code. It converts just2 pdf files into a new one. (It's part of a bigger project) Everthing worked fine - until the Acrobat version changed from 6 to 7. My problem is I got no COM Error - but the object does not work ... expandcollapse popupPDFMerge("c:\tmpp\1.pdf","c:\tmpp\2.pdf","c:\tmpp\out.pdf") func PDFMerge($File1, $File2, $Fileout) ; --------------------------------------- ; File1 first file ; File2 2nd file is inserted after ; Fileout is the new filename ; ; returns 1 on success ; returns -1 Error insert Pages ; returns -2 Error Object Create ;---------------------------------------- $SourcePDF = ObjCreate("AcroExch.PDDoc") if not IsObj($SourcePDF) then msgbox(0,"dbg1", "Err1") return -2 endif $b = $SourcePDF.Open($file1) msgbox(0,"b", $B) $TargetPDF = ObjCreate("AcroExch.PDDoc") if not IsObj($TargetPDF) then msgbox(0,"dbg2", "Err2") return -2 endif $c = $TargetPDF.Open($file2) msgbox(0,"c", $c) $intSourcePgs = $SourcePDF.GetNumPages msgbox(0,"num",$intSourcePgs) $intInsertPgs = $TargetPDF.GetNumPages if not $SourcePDF.InsertPages($intSourcePgs-1, $TargetPDF, 0, $intInsertPgs, False) = -1 then $SourcePDF.Close $TargetPDF.Close $SourcePDF="" $TargetPDF="" return -1 endif $b = $SourcePDF.Save(1, $fileout) $SourcePDF.Close $TargetPDF.Close $SourcePDF="" $TargetPDF="" return 1 endfunc greetings mozart90 Easy Zip Compression using XP Link to comment Share on other sites More sharing options...
Uten Posted November 13, 2006 Share Posted November 13, 2006 (edited) What is your value of $SourcePDF after this line? Wonder if the ObjCreate string should change after the acrobate update? $SourcePDF = ObjCreate("AcroExch.PDDoc") Edited November 13, 2006 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
mozart90 Posted November 14, 2006 Author Share Posted November 14, 2006 What is your value of $SourcePDF after this line? Wonder if the ObjCreate string should change after the acrobate update? $SourcePDF = ObjCreate("AcroExch.PDDoc") ... year thought about a changed object string too. but on the other hand by checking the $SourcePDF it seems to an object. I do not get an error with IsObj($SourcePDF)! So I'm a little confused greetings mozart90 Easy Zip Compression using XP Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now