Hello (I'm a really really newbie)
I'm trying to create a customization tool with PDF-Tool that can:
1. Open a PDF File
2. Search for a word in PDF File that is given by the user and it's dinamic
3. Extrat the page where the word is
4. Save with a specific name (part of the word that was found and inserted by the user)
Already tried to create but it was a failure. Can someone help? Or tell me it it even possible?
Thanks
Extract pages one-by-one considering word
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
- Tracker Supp-Stefan
- Site Admin
- Posts: 17938
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Extract pages one-by-one considering word
Hello nbmani,
You will need to program the logic you need to apply, and you can do that in e.g. JavaScript. However you can not then execute that JS with PDF Tools - you will need to do it with the Editor.
The Editor does have a "/runjs" command line parameter:
https://help.pdf-xchange.com/pdfxe ... ns_ed.html
So that maybe you can automate the execution of that script somehow.
Or alternatively - you can have your users open the files in the Editor, and run the JS through the Editor's UI.
A simple script might:
1) Open a pop-up to ask the user input
2) Execute the script that would perform the search of the file, and e.g. remove all pages that do not match the search criteria, and then save the rest of the pages under a new file name following your desired naming convention using part of the user input as well.
Kind regards,
Stefan
You will need to program the logic you need to apply, and you can do that in e.g. JavaScript. However you can not then execute that JS with PDF Tools - you will need to do it with the Editor.
The Editor does have a "/runjs" command line parameter:
https://help.pdf-xchange.com/pdfxe ... ns_ed.html
So that maybe you can automate the execution of that script somehow.
Or alternatively - you can have your users open the files in the Editor, and run the JS through the Editor's UI.
A simple script might:
1) Open a pop-up to ask the user input
2) Execute the script that would perform the search of the file, and e.g. remove all pages that do not match the search criteria, and then save the rest of the pages under a new file name following your desired naming convention using part of the user input as well.
Kind regards,
Stefan
Re: Extract pages one-by-one considering word
Hi, thanks for your reply. I write a JS Script that can do that. But now I placed the code in this folder:
AppData\Roaming\Tracker Software\PDFXEditor\3.0\Javascripts and is not appearing in the toolbar..
Can someone help?
AppData\Roaming\Tracker Software\PDFXEditor\3.0\Javascripts and is not appearing in the toolbar..
Can someone help?
- Tracker Supp-Stefan
- Site Admin
- Posts: 17938
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Extract pages one-by-one considering word
Hello nbmani,
You will need to include some commands in that script to allow it to appear as a button in the Editor UI.
Have you seen e.g. this topic and the JS code written by Mathew there:
viewtopic.php?p=168034&hilit=js+button#p168034
Or this one:
viewtopic.php?p=162930&hilit=app.addToolButton#p162930
They both illustrate the code you need to add a menu item button.
Please note that they will appear like this in an "Add-on Tools" tab on the ribbon UI: Kind regards,
Stefan
You will need to include some commands in that script to allow it to appear as a button in the Editor UI.
Have you seen e.g. this topic and the JS code written by Mathew there:
viewtopic.php?p=168034&hilit=js+button#p168034
Or this one:
viewtopic.php?p=162930&hilit=app.addToolButton#p162930
They both illustrate the code you need to add a menu item button.
Please note that they will appear like this in an "Add-on Tools" tab on the ribbon UI: Kind regards,
Stefan
Re: Extract pages one-by-one considering word
I read both posts and added this part to my script, below I'm pasting part of it:
app.addToolButton({
cName: "ExtractPagesByKeywordsExtractIndependentbyorder",
cLabel: "Search and extract as independent files by order",
cExec: "extractPagesByKeywordsExtractIndependentbyorder()",
cTooltext: "Extract pages containing specific keywords",
cEnable: true,
nPos: -1,
cIcon: "ZoomIn"
});
The add-on were working while I was working in one computer. I've made the same steps and now doesn't appear
app.addToolButton({
cName: "ExtractPagesByKeywordsExtractIndependentbyorder",
cLabel: "Search and extract as independent files by order",
cExec: "extractPagesByKeywordsExtractIndependentbyorder()",
cTooltext: "Extract pages containing specific keywords",
cEnable: true,
nPos: -1,
cIcon: "ZoomIn"
});
The add-on were working while I was working in one computer. I've made the same steps and now doesn't appear
- Tracker Supp-Stefan
- Site Admin
- Posts: 17938
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Extract pages one-by-one considering word
Hello nbmani,
I do not have the rest of your code that does the actual work - so I did comment the cExec: line, saved this in a .js file inside %Appdata%\Tracker Software\PDFXEditor\3.0\JavaScripts, restarted the Editor - and your button is there:
So can you please check whether you have not e.g. disabled JS for that machine? Or are you using the classic UI interface on it?
Kind regards,
Stefan
I do not have the rest of your code that does the actual work - so I did comment the cExec: line, saved this in a .js file inside %Appdata%\Tracker Software\PDFXEditor\3.0\JavaScripts, restarted the Editor - and your button is there:
So can you please check whether you have not e.g. disabled JS for that machine? Or are you using the classic UI interface on it?
Kind regards,
Stefan
Re: Extract pages one-by-one considering word
This is my settings....there's something wrong?
Re: Extract pages one-by-one considering word
And I'm not using a classic ribbon
- TrackerSupp-Daniel
- Site Admin
- Posts: 8600
- Joined: Wed Jan 03, 2018 6:52 pm
Re: Extract pages one-by-one considering word
Hello, nbmani
If you are not using the current modern "Ribbon UI" than you would be using the "Classic UI" instead. As your statement Doesn't really clarify which one you are using, I will explain both.
In the Classic UI, the addon tools should appear below the properties toolbar, as shown below: If this toolbar is not visible, it may be hidden, you cna enable it by right clicking on blank space in the UI: Likewise, in the ribbon UI, you have already seen Stefan's images above, if this toolbar is not visible, it may also be hidden, and can similarly be enabled from the right click menu: If the tool still does not appear, I should ask, are you using a portable version of the software on any of these devices? If so, the portable cannot access the %appdata% javascripts folder, and you would instead need to place the JS inside of a "JavaScripts" folder in the portable directory.
Kind regards,
If you are not using the current modern "Ribbon UI" than you would be using the "Classic UI" instead. As your statement Doesn't really clarify which one you are using, I will explain both.
In the Classic UI, the addon tools should appear below the properties toolbar, as shown below: If this toolbar is not visible, it may be hidden, you cna enable it by right clicking on blank space in the UI: Likewise, in the ribbon UI, you have already seen Stefan's images above, if this toolbar is not visible, it may also be hidden, and can similarly be enabled from the right click menu: If the tool still does not appear, I should ask, are you using a portable version of the software on any of these devices? If so, the portable cannot access the %appdata% javascripts folder, and you would instead need to place the JS inside of a "JavaScripts" folder in the portable directory.
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
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