Tracking changes using overlays  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, 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
Lambchop
User
Posts: 34
Joined: Mon May 02, 2022 5:58 pm

Tracking changes using overlays

Post by Lambchop »

I am trying to decouple the raw PDF form from any changes made to the form. Would you have any recommendation on how to do this? My current solution is to use overlays, but I have not found much documentation on how to implement overlays and the FullDemo does not have any functioning overlay that I could find.

I am completely open to changing my approach, but if you agree that overlays is a good approach then I need to know the following. Are there any code samples on overlay management for add, edit, delete? As I understand it (but please correct me if I am wrong), an overlay is another PDF file with a transparent background so this means that I can save individual overlays and then restore them in a particular order? Do I have to save overlays with the starting PDF or can I save them individually?

What is the reference to find the current list of PDF changes as tracked by the Undo/Redo list? It is possible that I could use this list to track filter out display Add/Edit/Delete changes. The concept is that I need to toggle the display to show only the adds, only the edits, and only the deletes. Ultimately, I need to filter out any diagramming or comment objects from the raw PDF as well.

Let me know if there is a better approach than using Overlays, but if there is not, then do you guys have any sample code for the complete management of the overlays?
Big Thanks!
-Eric
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Tracking changes using overlays

Post by Ivan - Tracker Software »

Looks like the concept you decided to implement is a little bit outside of what PDF can provide. And what the SDK can provide as well.

PDF does not have any overlays (I would encourage you to read the PDF spec first). At all.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
Lambchop
User
Posts: 34
Joined: Mon May 02, 2022 5:58 pm

Re: Tracking changes using overlays

Post by Lambchop »

Hmmm... the concept of "overlays" are on your EU website ... https://pdf-xchange.eu/epdfx6/overlay.htm
But technically, your specs refer to them as PDF layers ... https://www.pdf-xchange.com/knowledgebase/547-What-are-Layers-in-PDF

I apologize for any confusion on the topic, as I am sure that XChange does support layers. So specifically, I am looking at the "visibility groups" within the PDF. I am needing some guidance on how to find the coding samples using these groups. When I type in "layer" in the help documentation, I do not find much direction. For example: https://sdkhelp.pdf-xchange.com/view/PXV:IPXV_LayersView and https://sdkhelp.pdf-xchange.com/view/PXV:IPXV_DocumentView_LayersView and https://sdkhelp.pdf-xchange.com/view/PXV:op_layers_modify.

I do not know where I made things confusing but hopefully this makes more sense in the context of my original post.
Let me know if there is some code or url that I am missing that can help me pull the concept of layers/visibility groups together.
Best Wishes
-Eric
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8440
Joined: Wed Jan 03, 2018 6:52 pm

Re: Tracking changes using overlays

Post by TrackerSupp-Daniel »

Hello, Lambchop

First, that is not our "EU website" that is actually a link to one of our largest Resellers website.

Now, regarding overlays and layers, These are two very different things. An overlay is akin to a watermark, you can place a copy of the content overtop of the page, but it will not appear on a separate layer. This is still possible when printing, as mentioned on their website, simply use the overlay category from the Standard printer when you initiate printing of the document. Otherwise, you can use the watermark feature in the Editor to place an overlay.

That is distinctly differnt from "layers" however. In PDF, "Layer" is a misnomer, the only reason that we use the term is because Adobe coined the name for the feature when they implemented it, and now everyone else uses the same term, despite its glaring differences from the concept of layers in any other application. This article offers details about what layers are in PDF: https://www.pdf-xchange.com/knowle ... ers-in-PDF

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Lambchop
User
Posts: 34
Joined: Mon May 02, 2022 5:58 pm

Re: Tracking changes using overlays

Post by Lambchop »

Daniel - I don't think you have actually read my posts. The fact that you sent me a link to the same link that I already posted is frustrating. It looks like you have me confused with someone else because I am a developer and your reply suggests you think I am a product user.

Postings due to PDF jargon (overlay vs layer vs optional content groups vs visibility groups) is distracting on this thread. My assumption is the jargon itself would not be the primary discussion point. This is a developer question and I am looking for a developer coding reply and not a repeat of what I have already posted.

I am asking how to programmatically create a layer, assign objects and then pull the objects from a layer, and if I can save this layer as a separate object or if it must be saved as part of the PDF.
Thanks
-Eric
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Tracking changes using overlays

Post by Ivan - Tracker Software »

Unfortunately, methods for the creation and manipulation of IPXC_OCG and IPXC_OCMD are not exposed at the moment.

As you know, "layers" in PDF are not the same as layers in CAD or image editors. And it is hard to implement the same manipulations with them. Particularly, you cannot save or extract a layer as a separate object, because there may be a lot of different parts of PDF document (parts of pages' or xforms' contents, annotations, XObjects, etc.) directly or indirectly associated with the layer.
An especially tough situation is with content, and you cannot simply insert BDC/EMC whenever you want.

At the moment we do provide layers manipulations for the end user and only a very small part of that is available via the Core or Editor SDK.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
Lambchop
User
Posts: 34
Joined: Mon May 02, 2022 5:58 pm

Re: Tracking changes using overlays

Post by Lambchop »

Ivan - Your feedback makes perfect sense - Thank You! I was guessing that you guys are using some kind of hashtable or dictionary to group the different objects so that users can display or not display. Bummer that this part is not exposed for read-writes, but again, I can imagine the headaches of protecting those methods from developers.

Is there a way to loop through each object type embedded in the PDF? And if so, are the properties exposed? Technically, these properties would be the same so that they could be deleted and recreated (exactly like the Undo/Redo functionality).
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Tracking changes using overlays  SOLVED

Post by Ivan - Tracker Software »

I was guessing that you guys are using some kind of hashtable or dictionary to group the different objects so that users can display or not display.
We calculate the visibility state of OCGs and OCMDs and during rendering page content items, comments, etc. are rendered only if the associated OCG/OCMD is visible.
I can imagine the headaches of protecting those methods from developers.
Honestly, a headache is to expose them ;)
Is there a way to loop through each object type embedded in the PDF? And if so, are the properties exposed? Technically, these properties would be the same so that they could be deleted and recreated (exactly like the Undo/Redo functionality).
PDF can be handled on different levels.
On a low level (COS), you can enumerate all indirect PDF objects - dictionaries, streams, arrays, etc. For sure, you can modify them, but these modifications might not be taken into account as higher-level objects might already cache some values.
On a higher level (Core) you have objects like documents, pages, annotations, form fields, etc. There is no common way to go through all these objects. For each object type, you have to use a separate approach.
For example, if you want to enumerate all pages in a document, it is easy - you get IPXC_Pages object from the document, and go through all pages using its Count and Item properties.
But if you want, for example, to manually enumerate all fonts in the document, it is much more complicated - you have to go through all pages, get their content, got through all used fonts, and go recursively through all used XForms there, etc. Fortunately, to avoid that, there is EnumFonts method for that.
And so on.
If you are making changes on that level, as usual, there is no Undo/Redo. If you need it, you will have to provide your own mechanism for that.

To use Editor's Undo/Redo mechanism, you have to use operations on the Editor level for all your modifications. If you are planning to make modifications outside of operations provided by the Editor, and you want to keep Undo/Redo consistent, you can use IPXV_Document::OperationHistory and provide your own IOperationHistoryItem's which will handle Undo/Redo for your change(s).

HTH
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
Post Reply