How to "inject" into "Save As Optimized..." dialog and execution  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
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

How to "inject" into "Save As Optimized..." dialog and execution

Post by zarkogajic »

Hi Support,

Here's what I'm after:

1. I'd like to get my hands on the IUIX_Dialog displayed when a user goes for "File - Save As Optimized..." command. Such a dialog does not appear in "DlgTemplates.xml" (Resources.dat) and therefore I do not know how to implement an IUIX_EventMonitor for it. Is that even possible (since this command is from the plugin)? If possible I will have more questions :)

2. I would need to get notified once the "save as optimized..." file is saved to the file system. For this I have my custom IUIX_CmdHandler.OnNotify (UIX_CmdNotify_Exec) for "cmd.pdfopt.pages". Using it I can catch the moment when the command is executed and the "Optimize PDF" dialog appears to the user. If the user clicked "ok" on it - the "Save File" dialog appears and if "Save" button is clicked, the "e.afterShowOpenSaveDialog" is triggered and I can use IPXV_ShowOpenSaveDialogEvent to get to the file name the user used for saving the optimized file.

And at this moment I'm stuck, because saving goes on and I do not have a way to figure out when it is done (and the file is available on the file system so I can do something with it).

Any idea / help?

p.s.
Why: I want to add an option to linearize a document after saving as optimized. I know how to linearize.

-žarko
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to "inject" into "Save As Optimized..." dialog and execution

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

Is this still needed or does this topic answer your questions:
viewtopic.php?f=66&t=35186

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: How to "inject" into "Save As Optimized..." dialog and execution

Post by zarkogajic »

Hi Alex,

Q1 is still open :)

That is : is it possible to get IUIX_Dialog displayed when a user goes for "File - Save As Optimized..." - as I'd like to place a check box on it (on the Cleanup "tab").

-žarko
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to "inject" into "Save As Optimized..." dialog and execution

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

How does it differ from other IUIX_Dialog extraction? I mean, for example any other dialog like Crop Pages.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: How to "inject" into "Save As Optimized..." dialog and execution

Post by zarkogajic »

Hi Alex,

Do not know the dialog name / id (not found in DlgTemplates).

-žarko
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to "inject" into "Save As Optimized..." dialog and execution

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

The ID of that dialog is dlg.PDFOptimizer. And it's not inside of the DlgTemplates as that's a plugin's dialog.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: How to "inject" into "Save As Optimized..." dialog and execution

Post by zarkogajic »

Hi Alex,

I can catch e.Visible for 'dlg.PDFOptimizer', but pTarget in my IUIX_EventMonitor's OnEventMonitor is not IUIX_Dialog (nor any of pTarget.Parents) - so cannot do anything with it :( What is pTarget when e.Visible for that dialog?

What I am after: to place a check box here:

image.png
image.png (82.2 KiB) Viewed 1709 times

Or even better here:

image.png

-žarko
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: How to "inject" into "Save As Optimized..." dialog and execution

Post by zarkogajic »

Hi Support,

Any options here?

-žarko
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: How to "inject" into "Save As Optimized..." dialog and execution  SOLVED

Post by zarkogajic »

The struggle was real, but I finally figured out :)

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

Re: How to "inject" into "Save As Optimized..." dialog and execution

Post by Sasha - Tracker Dev Team »

Hello zarkogajic,

Glad that you have found a solution :)

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply