Command line : extract pages from pdf

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
NeedAutomation
User
Posts: 2
Joined: Wed Oct 19, 2022 3:20 pm

Command line : extract pages from pdf

Post by NeedAutomation »

Hello,

I'd like to extract pages from a big pdf using command lines (because vba macro, range to be extracted varies).
While the print command line has a "pages" argument, and the open command line has a "page" argument, I can't seem to find the equivalent for the "pdft.tool.extractPages" tool's range.

Can you please help me with the syntax ?

Thanks a lot in advance.

BR,
Gregoire
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6894
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: Command line : extract pages from pdf

Post by Paul - Tracker Supp »

HI NeedAutomation

I am afraid that this isn't available from the command line for PDF-Tools.
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
NeedAutomation
User
Posts: 2
Joined: Wed Oct 19, 2022 3:20 pm

Re: Command line : extract pages from pdf

Post by NeedAutomation »

I'd be very grateful if you could consider adding such a feature in the future.
Extracting pages is one of the most basic operations one does with pdfs and should most definitely be part of the command lines basics.
Using a macro to OCR pdfs to find some pattern is nice, but even nicer is being able to act on it (split the file based on the pattern is one of those possible actions).

I'll just use a workaround in the meantime, but please do keep me posted if/when this is implemented. Code shouldn't be much different from that of the print command so I'll keep my hopes up that it comes soon :wink:

(Very inefficient) workaround if anyone is faced with the same problem :
Before code execution
  • Export and save the settings of pdft.tool.splitMergePDF as Split the Input file "every 1 pages in Separate document" and Autoname
  • Export and save the settings of pdft.tool.splitMergePDF as Merge All pages to one document
Code execution
  • Import your saved Split settings
  • Run pdft.tool.splitMergePDF with the file you want to extract stuff from as parameter
  • Import your saved Merge settings
Loop through
  • Run pdft.tool.splitMergePDF with the previously generated autonamed files as parameter
  • Delete autonamed source files of the newly created extract
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8548
Joined: Wed Jan 03, 2018 6:52 pm

Re: Command line : extract pages from pdf

Post by TrackerSupp-Daniel »

Hello, NeedAutomation

I am afraid that while we have run this by the powers that be, specifying the page range via CMD in PDF-Tools has for now been strictly denied. These functions can be controlled manually through the PDF-tools UI. However, complete automation, allowing control from a third-party app, or use with command lines in a way that allows for extended automation of that ilk, is not part of the current design philosophy of PDF-Tools. It unfortunately would open PDF-Tools licenses to many additional avenues of license abuse.

PDF-Tools is designed and intended as a single user batch processing application, something you use on your own local PC, for tasks that you personally need to perform in repetition, not something that is incorporated as part of another software or suite of actions.

Kind regards,
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
huby1691
User
Posts: 3
Joined: Thu May 04, 2017 6:34 am

Re: Command line : extract pages from pdf

Post by huby1691 »

Hello Daniel,

I have a similar problem as NeedAutomation and I do not understand the reason why it should be license abuse. Tracker has stopped all sales of SDK, so there is no possibility to get approriate products from your company.
It is only for my private use: I get a daily newspaper in pdf-format where ramdomly some pages put together to double-pages. For convenient reading on a portrait-monitor I have to split those pages.
There are possible workarounds, but it would be much nicer, if there is a cmd-line-option for specifying page-range.

With kind regards,
huby1691
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6894
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: Command line : extract pages from pdf

Post by Paul - Tracker Supp »

Hi huby1691

thanks for the post. While I appreciate that ytou are an honest end user with a legitimate use case, the feature requested does indeed open the product to license abuse. It would mena a less principled operator could set up a single user instance and have an entire Enterprise use it.

Unfortunately the policy is firm and we will not be making exceptions at this time.

Regarding the SDK, email me, paul@tracker-software.com, no promises but maybe we can come to an alternative arrangement to see you get what you need.

regards
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
huby1691
User
Posts: 3
Joined: Thu May 04, 2017 6:34 am

Re: Command line : extract pages from pdf

Post by huby1691 »

Hello Paul,

thank you for answering my post. It was just an attempt to understand your reasons for not offering such a function. So for the moment I am happy with my solution and I thank you offering me your help.

Sincerely,
huby1691
Nimrod_189
User
Posts: 35
Joined: Wed Sep 23, 2009 8:39 am

Re: Command line : extract pages from pdf

Post by Nimrod_189 »

One possibility would be to export the pages one by one to a text file with the Xpdf tools (https://www.xpdfreader.com/download.html) (page by page) and extract these text files to find the appropriate pages. Now that you have found the relevant pages, you can use pdftk (https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/) to extract the desired pages.

The Xpdf tools and the pdftk are wonderfully easy to use in vba via the command line.
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8548
Joined: Wed Jan 03, 2018 6:52 pm

Command line : extract pages from pdf

Post by TrackerSupp-Daniel »

:)
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