What about new drawing functions...

Forum for the PDF-XChange Editor - Free and Licensed Versions

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

Post Reply
Puffolino
User
Posts: 318
Joined: Wed Feb 09, 2011 1:06 pm

What about new drawing functions...

Post by Puffolino »

Hi,

I've written a small program which demonstrates how new drawing functions could be added. Have a look at the small demo film which shows how it works.

The program is Windows only, you also need to add the Shortcut Ctrl+Shift+Alt+F1 to the Polyline function. And it is just a demonstartion tool, so no checks are done if the PDFXChange-Editor window is on top and active, when you press Shift+Ctrl+F1 to invoke the tool (not the Alternate key)...

Maybe this could be done using Javascript as well? Or is there an API for doing such things more easily?
Attachments
PDF Drawing.zip
(219.32 KiB) Downloaded 51 times
Last edited by Puffolino on Mon Jan 20, 2020 6:18 am, edited 1 time in total.
Puffolino
User
Posts: 318
Joined: Wed Feb 09, 2011 1:06 pm

Re: What about new drawing functions...

Post by Puffolino »

Hm, the posting text above seems has been changed automatically ("Spam message...") because of the key word "m o v i e"? :shock:

However I try to post a better demo here.
Demo.zip
(577.83 KiB) Downloaded 46 times

And one hint, you'll get a systray icon which allows you to exit the tool (left click for a menu or just double or right click on the icon).
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: What about new drawing functions...

Post by Sasha - Tracker Dev Team »

Hello Puffolino,

You can use the JS addAnnot method of the document to draw anything that you like https://help.adobe.com/en_US/acrobat/ac ... 3_addAnnot
Here's an Example 4 executed via the Editor:
image.png
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Puffolino
User
Posts: 318
Joined: Wed Feb 09, 2011 1:06 pm

Re: What about new drawing functions...

Post by Puffolino »

C :shock: :shock: L !

Now showing a dialog to change the parameters would be perfect :wink:
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17892
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: What about new drawing functions...

Post by Tracker Supp-Stefan »

Hello Puffolino,

Is the above a request for us to provide such a dialogue or is it more a note to self to make your own tool be able to draw such shapes?
If you want to make those drawing shapes directly in the Editor - you can do so by opening the JS console (Ctrl+J) - and then pasting the code samples from the page Sasha linked in there. The parameters to modify should then be pretty obvious.

Or you can make a custom JS button - which when clicked will invoke a dialogue, where you can enter your parameters, and then the script can draw on the page using the parameters supplied in the dialogue box.

Regards,
Stefan
Puffolino
User
Posts: 318
Joined: Wed Feb 09, 2011 1:06 pm

Re: What about new drawing functions...

Post by Puffolino »

Hello Stefan,
not sure, just babbled loud...

> a javascript dialog sounds fine (will google a little bit), but scripts (or buttons with scripts) can't be triggered by shortcuts - not so good.

> a tool like mine could control theoretically do a lot of things, but an API would be useful here because the pdfxchange editor does not use a standard windows construct for handles and messages (I couldn't manage to find a possibility to activate the Polyline using a sendmessage)

Also thought doing a mix of these two worlds, creating a javascript dynamically and start it then. The first part can be done easily, the second would need to popup the javascript console - wouldn't it be nice to allow starting a script in a hidden mode?

Cheers.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17892
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: What about new drawing functions...

Post by Tracker Supp-Stefan »

Hello Puffolino,

You can write your JS and make a custom button that will appear in a new "Add-on Tools" ribbon tab:
Add_on_buttons.png
As explained e.g. here:
viewtopic.php?f=62&t=28407&p=111667

And then that custom Script could show a dialogue window asking you for the input values:
pop_up_dialogue.png
pop_up_dialogue.png (51.92 KiB) Viewed 1173 times
(How to create advanced dynamic stamps is explained here: https://www.pdf-xchange.com/knowledgebase/543)

So everything will be handled inside the Editor - via JS alone, and there will still be user interaction to supply the dynamic input details as needed.

Cheers,
Stefan
Post Reply