Hey my dear friends! :D
I'm a bit desperate here. I made a script with VBA (macro). [i](NOTE: VBA, not VB. I just stress this because, when I searched for solutions on the internet, some people sometimes seemed unaware of the fact, that it's not the same. Or at least I had the feeling that this is the case...)[/i] It worked pretty well and people are already using it. It mainly searches through a .pdf file and then, if it found a special word, it should add some pages with insertPages. (that's only roughly explained of course. I try to keep things simple for you guys! :D)
As I said, it worked pretty well. But now I have to add something new to the application and since I haven't developped the App for myselfe, but rather for other people, I didn't use the macro for quite a while.
I have installed Acrobat 9 Pro now, but developped was the macro with Acrobat 6. Because of this fact, Acrobat won't allow me to use the insertPages methode.
So, I read on the internet, that I could use trustedFunction. But I just don't know how to do it.
Here is a little code snippet:
... Set AVDoc = CreateObject("AcroExch.AVDoc") AVDoc.Open aPathDat2, speicherNameAttachment Set PDDoc = AVDoc.GetPDDoc Set jso = PDDoc.GetJSObject With jso ... If UCase(index) <> UCase(daten.Fields(6)) Then 'MsgBox "Index Falsch. IST: " + Index + " SOLL: " + daten.Fields(6) funktionsAufruf = fehlerMeldungenIndex(daten.Fields(1), index, daten.Fields(6)) Else zeichnungsPfad = daten.Fields(2) + daten.Fields(0) + ".pdf" einfuegOrt = .numPages - 1 .InsertPages einfuegOrt, zeichnungsPfad ... end with ...
I think that actually only the part with the .insertPages is important for you guys.
How can I make a trustedFunction? I found solutions containing something like this (from the Javascript for Acrobat API Reference):
myTrustedFunction = app.trustedFunction( function() { <function body> } );
But I just don't know how to include this in my code! :(
I hope, this is enough information for you, otherwise tell me! ;)
Kind Regards,
Hanfwurst
P.S. Excuse me if I explained all a bit complicated. This is most certainly mainly because I'm not a native! ;)
P.P.S. I just noticed that I put this Thread in the Forms: Acrobat section instead of the Javascript section. I'm sorry! You can change that of course!
See this article: http://www.acrobatusers.com/tutorials/2008/10/js_using_trusted_functions/
George