I am trying to create this

enter image description here

Having a look at this example and the PDF specs (optional content configuration dictionary keys), I am quite confused about how to create that vs what I have at the moment

enter image description here

Any suggestion on which dictionary key / setup I should look into? Note: I manipulate the PDF header programmatically (with PyPDF2) and I am not interested in Acrobat Reader options.

1 Answer 1


The solution is to make sure that the parent object is an OCG and not a string.

/Order [ 25 0 R [ 22 0 R 23 0 R 24 0 R ] 21 0 R ]

and not

/Order [ (mystring) [ 22 0 R 23 0 R 24 0 R ] 21 0 R ]

So if you don't have a natural candidate you want to designate as the parent, you need to create an additional OCG with the name you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.