Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
Tips for working with OCGs and Config Dictionaries |
Post Reply |
Author | |
Rowan
Moderator Group Joined: 10 Jan 09 Status: Offline Points: 398 |
Post Options
Thanks(0)
Posted: 10 Mar 11 at 9:15AM |
(Read this for a refresher on the difference between OCGs and Layers in Quick PDF's world). The OptionalContentGroupCount function counts all of the OCGs that are listed in the OCG array in the PDF, but there is a different dictionary in the PDF which deals with the configuration of the OCGs and whether or not specific OCGs are actually used in the conforming PDF viewer. Most of the time the total number of OCGs found in the OCG array and the number of OCGs that the configuration dictionary directs the conforming PDF viewer to display are the same, but sometimes they are not. This means that it is prudent to check the GetOptionalContentConfigOrderCount function to see if a configuration dictionary exists, and if one does, then to use the GetOptionalContentConfigOrderItemID, GetOptionalContentConfigOrderItemLabel, GetOptionalContentConfigOrderItemLevel, and GetOptionalContentConfigOrderItemType functions to get all of the information required to determine which OCGs are actually displayed in the Layers panel in Adobe Reader. Here is some C# code to show you an example of how to check the configuration dictionary to see what OCGs will be shown in Adobe Reader: QP.LoadFromFile(OpenFilePath()); int ContentConfigCount = QP.GetOptionalContentConfigCount(); txtOutput.AppendText("Total Content Config Count: " + ContentConfigCount); txtOutput.AppendText(Environment.NewLine); int OrderCount = QP.GetOptionalContentConfigOrderCount(1); for (int i = 1; i <= OrderCount; i++) { int OrderItemID = QP.GetOptionalContentConfigOrderItemID(1, i); string OrderItemLabel = QP.GetOptionalContentConfigOrderItemLabel(1, i); int OrderItemLevel = QP.GetOptionalContentConfigOrderItemLevel(1, i); int OrderItemType = QP.GetOptionalContentConfigOrderItemType(1, i); txtOutput.AppendText("Order Item ID: " + OrderItemID); txtOutput.AppendText(Environment.NewLine); txtOutput.AppendText("Order Item Label: " + OrderItemLabel); txtOutput.AppendText(Environment.NewLine); txtOutput.AppendText("Order Item Level: " + OrderItemLevel); txtOutput.AppendText(Environment.NewLine); txtOutput.AppendText("Order Item Type: " + OrderItemType); txtOutput.AppendText(Environment.NewLine); } |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store