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, Sean - Tracker, Chris - Tracker Supp, Tracker Supp-Stefan

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

Optimized PDF with JS

Post by xcq » Tue Jan 22, 2019 1:45 pm

Can I Optimized PDF file with JAVASCRIPT ?
Can you show me a demo?

User avatar
TrackerSupp-Daniel
Site Admin
Posts: 2414
Joined: Wed Jan 03, 2018 6:52 pm

Re: Optimized PDF with JS

Post by TrackerSupp-Daniel » Tue Jan 22, 2019 8:39 pm

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.
Daniel McIntyre
Support Technician
Tracker Software Products (Canada) LTD

Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623

User avatar
TrackerSupp-Daniel
Site Admin
Posts: 2414
Joined: Wed Jan 03, 2018 6:52 pm

Re: Optimized PDF with JS

Post by TrackerSupp-Daniel » 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!
Daniel McIntyre
Support Technician
Tracker Software Products (Canada) LTD

Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623

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

Re: Optimized PDF with JS

Post by xcq » Wed Jan 23, 2019 12:45 am

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: 2414
Joined: Wed Jan 03, 2018 6:52 pm

Re: Optimized PDF with JS

Post by TrackerSupp-Daniel » Wed Jan 23, 2019 1:19 am

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.
Daniel McIntyre
Support Technician
Tracker Software Products (Canada) LTD

Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623

Post Reply