How do I set 'Print' and other Usage visibility attributes on a PDF layer?

Q : We are testing “PDFNet” and I have the following (programming) question:

I want to set the property “print” of a group to “Never print”.

I have created the group (layer) by your examplecode, see code below:

Dimdoc As PDFDoc= New PDFDoc(“d:\Temp\TestOCG.pdf”)

Dimcfg As Config= doc.GetOCGConfig()

DimhiddenGroup As Group= CreateLayer(doc, “doHidden”)

Can you tell me how, if possible, I can set this print-property for the created group?

A:

The relevant section in ISO 32000 PDF Reference is 8.11.4.4, “Usage and Usage Application Dictionaries”.

PrintState entry in Print dictionary (which is part of Optional Content Usage Dictionary) should be set to ‘OFF’.

The Usage dictionary is optional entry in OCG (Optional Content Group) dictionary.

For example, you could try the following:

Obj usg = hiddenGroup.GetSDFObj().PutDict(“Usage”);

Obj prn = usg.PutDict(“Print”);

prn.PutName(“PrintState”, “OFF”);

// Obj v = usg.PutDict(“View”);

// v.PutName(“ViewState”, “OFF”);