These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Deleting pdf pages from VB6

Laverio
Registered: Mar 17 2008
Posts: 4
Answered

Hi, I'm new to the PDF DOM, and I'm trying to delete some pages from a module made with LiveCycle Designer. I've tried all JS commands in the reference, but I suppose I've to use the XFA DOM. Can anyone give me an hint on how access it from VB and remove the nodes?

I'm blocked on this piece of code:

Set pddoc = aAVDoc.GetPDDoc
Set jso = pddoc.GetJSObject

Set oXFA = jso.xfa.resolveNode("form.modulo1[0].P1.Header[0]")

But I can't get anything from the retrieved object not even the rawValue property.

Any help would be appreciated. Thanks!

My Product Information:
Acrobat Standard 8.1.2, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
It looks like you are moving in the right direction. However, I think you have a few issues to deal with.

First, I'm not sure the JSO will even work with a LiveCycle PDF.

Second, if you can retrieve the JSO from an XFA PDF, there is a problem with passing DOM objects across the ActiveX interface. You can only pass simple generic objects. You're best strategy here is to create a function in a folder level JavaScript file that performs everything on JS side. Then call this function from the VB script.

Third, an XFA form doesn't have pages like a regular PDF. It has subforms that can be mapped into pages. You may or may not be able to delete a particular subform. Also, your code is trying to operate on the "form" model. This model holds the runtime hierarchy. Deleting subforms from here doesn't delete them from the file. You need to operate on the "template" model, which holds the real XFA structure.

Fourth, how is this file generated? Have you automated LiveCycle Designer in some way? Or do you mean you have one of the Livecycle servers? If either of these is true, then you must have control over the initial generation of the form?

The document should be designed up front to show or not show the pages it needs to. Operating on it after it has already be encapsulated into a PDF is risky and unreliable.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Laverio
Registered: Mar 17 2008
Posts: 4
Oh well, to create the form I've used LiveCycle SE bundled with Acrobat 8, nothing more than a dynamic PDF form, I don't even suppose what pain in the the arsh would be using it to prepare digital receipts for my company. However, I will try calling an embedded JS function to remove (or add the pages) and thank you for the "template" hint, I had just spent two days trying to delete pages from the "form" object.
BTW Adobe documentation is not really clear on what you can do or not with the JS and the new XFA DOM.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
I have rarely ever read any Adobe Documentation that was clear. At least at first. It all makes much more sense after you understand it. It's that initial hump that's the problem;) That's what we're here for.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script