Optimized PDF with JS

This Forum is for the use of End Users requiring help and assistance for Tracker Software's PDF-Tools.

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

Post Reply
xcq
User
Posts: 2
Joined: Tue Jan 22, 2019 1:42 pm

Optimized PDF with JS

Post by xcq »

Can I Optimized PDF file with JAVASCRIPT ?
Can you show me a demo?
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Re: Optimized PDF with JS

Post by TrackerSupp-Daniel »

Hello xcq,

I do not believe it is possible, but I have asked the Dev team for feedback to make sure for you.

I am curious however, about why you would like to use JavaScript for this action, when we already have a highly configurable "Save as Optimized" function available in both our Editor and PDF-Tools?

Looking forward to your reply.
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
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Re: Optimized PDF with JS

Post by TrackerSupp-Daniel »

Hello again xcq,

I have just heard back from the Devs, and it appears it is possible to setup JS to call our optimize function, but when using this method you cannot control and of the settings. As I suspected however, it is not possible to do the actual optimization with JS alone.
Here is the Devs reply and Example:
To do that, saveAs method of document should be used with cConv parameter equal to conv.optimized.pdf
Example,

Code: Select all

this.saveAs({cPath:"/e/temp/test2.pdf", cConv:"conv.optimized.pdf"});
I hope this helps!
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
xcq
User
Posts: 2
Joined: Tue Jan 22, 2019 1:42 pm

Re: Optimized PDF with JS

Post by xcq »

TrackerSupp-Daniel wrote: Tue Jan 22, 2019 9:12 pm Hello again xcq,

I have just heard back from the Devs, and it appears it is possible to setup JS to call our optimize function, but when using this method you cannot control and of the settings. As I suspected however, it is not possible to do the actual optimization with JS alone.
Here is the Devs reply and Example:
To do that, saveAs method of document should be used with cConv parameter equal to conv.optimized.pdf
Example,

Code: Select all

this.saveAs({cPath:"/e/temp/test2.pdf", cConv:"conv.optimized.pdf"});
I hope this helps!
Thanks.I have try the code but it seems useless.The size of output file equal to the input file.
Because I have a lot of files to optimize so I want to do optimization with code.
How can I do with scripts(c# or JS)?
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Re: Optimized PDF with JS

Post by TrackerSupp-Daniel »

Hello xcq,

As I mentioned before, it is not possible to manage the settings when calling via JS, but the Editor and PDF-Tools suite both offer functions to optimize by default.
In PDF-Tools, Simply configure the settings and then run the tool, selecting all the files you wish to optimize at once (exactly what you are looking for):
image.png
Or in the Editor, open the desired document, and click File > save as optimized, one file at a time (not really what you are looking for):
image.png
If you absolutely have to do this via code, (thought I'm still unsure why you would want to when it already exists in a 3 click solution), you can take a look at our Editor SDK, which would offer the optimize function. Examples are available from our EditorSDK GitHub repository.
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
Post Reply