Print Page | Close Window

Modify PDF files model tree

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
Printed Date: 22 May 24 at 9:58AM
Software Version: Web Wiz Forums 11.01 -

Topic: Modify PDF files model tree
Posted By: Justme
Subject: Modify PDF files model tree
Date Posted: 17 Mar 14 at 5:24PM
I am creating pdf files that have layer data so they can be turned off and on as needed. Some of the layers also have attribute data that can be displayed with the model tree in Acrobat Reader. The problem is when there are multiple layers it takes many clicks with the Adobe PDF Object Data Tool to select an individual object. The first click selects all objects on the page, the next double click selects all objects in a layer and finally the last double click will select the individual item and display the data in the information window. It is my understanding that is by design in Acrobat. You can preselect a layer in the UI first and then double click an object to get it to select but that takes just as long.

We however receive PDF files from various public sources that the model tree has been ungrouped or flattened. This allows for single click selection of any object on the page.

I just need to figure out how to do it can anyone point be in the right direction? Our files are being created in ArcGIS and I use the Quick PDF Library to add links, automate page navigation between files, etc.   

Posted By: Justme
Date Posted: 17 Mar 14 at 5:28PM
Sorry, sample of model trees


Change to

Widget: 123
Widget: 456
Widget: 789
Thing: abc
Thing: xyz

Posted By: AndrewC
Date Posted: 19 Mar 14 at 11:01AM

Can you please upload a small sample file so we can see what is going on and post the section of code you are using to process the layers if any.


Posted By: Justme
Date Posted: 20 Mar 14 at 1:05AM
Thanks for the reply.  There are two PDF files at" rel="nofollow - . The sample.pdf file is a very basic sample file.  If you look at the layers they are listed in a hierarchy which I would like to flatten and remove a few from the layers list that should always be on (Other, Lables, etc.).  The model tree is the same which I would also like to flatten.

The second PDF file is from a vendor.  Just select "No" for the plug in warning when opening.  Please note the flattened layers and model tree.  This is what I would like to do with the files I am getting from ArcMap.  Yes I could buy the program used to create the second PDF but at $7000 it is a little too expensive.

There are also a few image files showing before and after of what I have in mind for the layers and model tree.  Cannot get images to upload to the forum.

Posted By: AndrewC
Date Posted: 21 Mar 14 at 5:26AM

Debenu PDF Library doesn't currently have and functions to work with Adobe created Model Trees.  I suspect there is an output option in ArcGIS that can flatten these Model Trees during the creation of the PDF file.  I suspect there is not similar option available on ArcMap.

Layers are pretty well supported in Debenu Quick PDF Library but I am having trouble working out how the Model Trees are even created / specified in the PDF specifications.


Posted By: Justme
Date Posted: 21 Mar 14 at 2:48PM
I was able to get the "Layers" fixed by digging/hacking through the raw binary file.  Apparently “/OCProperties<</D<</Order" controls the Layer tree.  Changed the following line, as noted below, and updated the affected xref and startxref pointers.  This will be done the "correct" way later just trying to figure it all out at the moment.
/OCProperties<</D<</Order[  19 0 R [ 20 0 R 21 0 R [ 22 0 R ] 23 0 R [ 24 0 R 25 0 R 26 0 R ] 27 0 R [ 28 0 R ] ]]>>/OCGs[ 19 0 R 20 0 R 21 0 R 22 0 R 23 0 R 24 0 R 25 0 R 26 0 R 27 0 R 28 0 R]>>
/OCProperties<</D<</Order[  (Layers) 24 0 R 25 0 R 26 0 R ]>>/OCGs[ 19 0 R 20 0 R 21 0 R 22 0 R 23 0 R 24 0 R 25 0 R 26 0 R 27 0 R 28 0 R]>>
Still working on the Model Tree but was making progress before calling it quits last night.  I think the model tree is controlled by the [Parent] [Kid] relationship of the objects.  I was able to hide the ones I did not want to show but also introduced an error into the file.  I think I just incorrectly recalculated one of the pointers.  Need to try setting the [Parent] of the I want displayed to the [Root] ??? and removing them from the their old [Parent] as [Kids].
Thanks for all your help so far.

Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 -
Copyright ©2001-2014 Web Wiz Ltd. -