[javascript] utilities for scripting  SOLVED

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

Moderators: Daniel - PDF-XChange, PDF-XChange Support, Paul - PDF-XChange, Vasyl - PDF-XChange, Chris - PDF-XChange, Sean - Tracker, Ivan - Tracker Software, Stefan - PDF-XChange

Post Reply
Mathew
User
Posts: 434
Joined: Thu Jun 19, 2014 7:30 pm

[javascript] utilities for scripting  SOLVED

Post by Mathew »

I never got around to posting this: I use these utility functions quite a lot in other scripts. I've tried to document them within the code, so I won't repeat here. The timeout and interval functions will not be needed in the 10.5 release of PDF-XChange.

Initially I was planning to minify the script, but because this is all loaded locally, I didn't see a need.
xutil v0.4.zip
(5.41 KiB) Downloaded 16 times

xutil.setInterval
xutil.setTimeout Note that capitalization matches javascript in browsers (the built-in app.setTimeOut() capitalizes 'Out'.)
  • These extend the built in app methods to allow one to pass functions. I find this much easier to work with because I can use closures. Instead of returning an object, they return an integer greater than zero on success.
xutil.clearInterval
xutil.clearTimeout
  • Functions to clear the interval or timeout set with the above functions.
xutil.getNewAnn
  • Get an annotation as soon as it's drawn
xutil.PXEmacro
  • Minimal PDF-XChange macros class for javascript
Last edited by Mathew on Wed Dec 04, 2024 1:07 am, edited 5 times in total.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19255
Joined: Mon Jan 12, 2009 8:07 am
Contact:

Re: [javascript] utilities for scripting

Post by Stefan - PDF-XChange »

Hello Mathew,

Many thanks for sharing those utilities you've prepared with other users here in the forums!

Kind regards,
Stefan
Mathew
User
Posts: 434
Joined: Thu Jun 19, 2014 7:30 pm

Re: [javascript] utilities for scripting

Post by Mathew »

I changed the parameters that get sent to the timeout and interval functions. Now 'this' (the current doc) is sent if no additional args are supplied, otherwise, only the additional args.
xutil v0.4.zip
(5.41 KiB) Downloaded 44 times
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19255
Joined: Mon Jan 12, 2009 8:07 am
Contact:

[javascript] utilities for scripting

Post by Stefan - PDF-XChange »

:)
Post Reply