Get the layers/OCG list and show/hide them

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Sean - Tracker, Chris - Tracker Supp, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
Max SAG
User
Posts: 30
Joined: Thu Oct 30, 2014 8:54 am

Get the layers/OCG list and show/hide them

Post by Max SAG » Mon Nov 26, 2018 10:50 am

Hi,

Using the PDF-XChange Core API SDK, I'm trying to get the list of the layers of the PDF document to hide and show them calling DrawToDevice. I already saw this topic: Show/hide layers/OCG by name
If I understood correctly they are called "Optional Content Groups (OCG)".

Get the layers
The list of layers seems to be available using IPXC_OCMD.OCG but I can't find a way to create or get this object.

Set the visiblity
As mentioned in the other topic, the visibility can be set using IPXC_OCContext.SetOCState, but I don't know what is the pOCObj parameter, maybe the IPXC_OCMD?

I tried to find examples in the GitHub samples without luck.

Thank you for your help,

Max

User avatar
Sasha - Tracker Dev Team
User
Posts: 4182
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Get the layers/OCG list and show/hide them

Post by Sasha - Tracker Dev Team » Tue Nov 27, 2018 7:58 am

Hello Max,

Right now, there is no direct way of working with OCGs/OCMDs directly via the Core API SDK.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Max SAG
User
Posts: 30
Joined: Thu Oct 30, 2014 8:54 am

Re: Get the layers/OCG list and show/hide them

Post by Max SAG » Tue Nov 27, 2018 10:45 am

Hi Sasha,

Thank you for your answer. Which of your SDK can interact with OCGs/OCMDs?

Best regards,

Maxime

User avatar
Sasha - Tracker Dev Team
User
Posts: 4182
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Get the layers/OCG list and show/hide them

Post by Sasha - Tracker Dev Team » Tue Nov 27, 2018 10:49 am

Hello Maxime,

For now, there is no full functionality on either level - though you can always do everything manually via the PDF Structure (as you would have done in the Viewer SDK) though this requires deep knowledge of the PDF structure and specification. Also, you can do operations available via the JS.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Max SAG
User
Posts: 30
Joined: Thu Oct 30, 2014 8:54 am

Re: Get the layers/OCG list and show/hide them

Post by Max SAG » Tue Nov 27, 2018 1:14 pm

Alex,

OK. I guess that IPXV_Inst::ExecuteJS is only available using the Editor API SDK?

Best regards,

Max

User avatar
Sasha - Tracker Dev Team
User
Posts: 4182
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Get the layers/OCG list and show/hide them

Post by Sasha - Tracker Dev Team » Tue Nov 27, 2018 2:43 pm

Hello Max,

Yes, Editor SDK it is.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Max SAG
User
Posts: 30
Joined: Thu Oct 30, 2014 8:54 am

Re: Get the layers/OCG list and show/hide them

Post by Max SAG » Thu Nov 29, 2018 5:39 pm

Hi Alex,

OK.
One more question as I try to estimate the work to do before beginning the development, if we manage to identify the layer in the PDF structure using the Core API SDK, will it be possible to use the IPXC_OCContext.SetOCState method to hide/show them? Even after checking the documentation, I still don't understand what IPXS_PDFVariant* pOCObj stands for.

Best regards,

Max

User avatar
Sasha - Tracker Dev Team
User
Posts: 4182
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Get the layers/OCG list and show/hide them

Post by Sasha - Tracker Dev Team » Mon Dec 03, 2018 10:10 am

Hello Max,

It stands for the PDF Structure Dictionary of the correspondent OCG or OCMD. You can get the Name entry to see the OCG name for comparison to do this use the Dict_GetString method of the IPXS_PDFVariant.
For more information, you will have to read the Optional Content chapter of the PDF Reference (in the latest one it's the 8.11. chapter) that you can find under the Graphics chapter.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Max SAG
User
Posts: 30
Joined: Thu Oct 30, 2014 8:54 am

Re: Get the layers/OCG list and show/hide them

Post by Max SAG » Thu Dec 06, 2018 3:06 pm

Hi Alex,

OK, thank you for your explanation.

Have a good day,
Max

User avatar
Sasha - Tracker Dev Team
User
Posts: 4182
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Get the layers/OCG list and show/hide them

Post by Sasha - Tracker Dev Team » Thu Dec 06, 2018 3:21 pm

:)
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply