Automation: Specific color for specific words in multiple PDFs
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
-
- User
- Posts: 13
- Joined: Mon May 24, 2021 8:59 am
Automation: Specific color for specific words in multiple PDFs
Hi,
i have to read a lot of academic journals.
Is it possible to automate a function so that I have to click just on one button instead of doing it every time manually: Define different colors for different words and highlight them with 1 click.
Example:
red: test, alpha
blue: monitor, result
green: statistic
I know that I can open muliple PDFs and do the coloring for each word but all open PDFs.
However, in the longrun, I would like to have an automated function where I just click on 1 button and thats it.
Do you know a solution for that?
i have to read a lot of academic journals.
Is it possible to automate a function so that I have to click just on one button instead of doing it every time manually: Define different colors for different words and highlight them with 1 click.
Example:
red: test, alpha
blue: monitor, result
green: statistic
I know that I can open muliple PDFs and do the coloring for each word but all open PDFs.
However, in the longrun, I would like to have an automated function where I just click on 1 button and thats it.
Do you know a solution for that?
-
- Site Admin
- Posts: 17960
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
Re: Automation: Specific color for specific words in multiple PDFs
Hello pdf-anna,
Welcome to our forums.
The code below can be executed through the console (Ctrl + J to start it):
And it will highlight all the instances of your "SearchWord" in any of your opened documents in green.
Some of the operations in the above script are executed in "privileged context" - so I do not think you can currently make this as a toolbar button, and will have to do it through the console.
Kind regards,
Stefan
Welcome to our forums.
The code below can be executed through the console (Ctrl + J to start it):
Code: Select all
var d = app.activeDocs;
for (var j = 0; j < d.length; j++){
for (var p = 0; p < d[j].numPages; p++){
var numWords = d[j].getPageNumWords(p);
for (var i = 0; i < numWords; i++){
var ckWord = d[j].getPageNthWord(p, i, true);
if ( ckWord == "SearchWord"){
var q = d[j].getPageNthWordQuads(p, i);
var l = d[j].addAnnot({
page: p,
type: "Highlight",
author: "PDF-XChange Editor",
strokeColor: color.green,
quads: q,
});
}
}
}
}
Some of the operations in the above script are executed in "privileged context" - so I do not think you can currently make this as a toolbar button, and will have to do it through the console.
Kind regards,
Stefan
-
- User
- Posts: 13
- Joined: Mon May 24, 2021 8:59 am
Re: Automation: Specific color for specific words in multiple PDFs
First of all, thank you for your fast reply.
Thank you for welcoming me
.
I have some questions:
1) How can I learn or use a pre-defined kit to "code" it by myself? So I can improve myself without asking you all the time.
2) Can I enhance the above code by multiple words and multiple colors as in my example above? Because if I do have to open console for each word and each color, I could too it the way I am used to (top right on Search, then searching the word, then on Settings, highlight all and select the color).
So If I can use multiple words and colors in the console, how would it look like according to my example above?
Thank you for welcoming me
![Smile :-)](./images/smilies/icon_smile.gif)
I have some questions:
1) How can I learn or use a pre-defined kit to "code" it by myself? So I can improve myself without asking you all the time.
2) Can I enhance the above code by multiple words and multiple colors as in my example above? Because if I do have to open console for each word and each color, I could too it the way I am used to (top right on Search, then searching the word, then on Settings, highlight all and select the color).
So If I can use multiple words and colors in the console, how would it look like according to my example above?
-
- Site Admin
- Posts: 17960
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
Re: Automation: Specific color for specific words in multiple PDFs
Hello pdf-anna,
The above code is written in JS, and there is a specific manual for PDF Files (created by Adobe, but we should support most of it as well):
http://wwwimages.adobe.com/content/dam/ ... erence.pdf
You can indeed run this script for multiple words and multiple colours, sure!
Please note that there are some predefined colours for PDF files, and custom colours can also be specified (take a look at page 193 of the above linked file).
Kind regards,
Stefan
The above code is written in JS, and there is a specific manual for PDF Files (created by Adobe, but we should support most of it as well):
http://wwwimages.adobe.com/content/dam/ ... erence.pdf
You can indeed run this script for multiple words and multiple colours, sure!
Please note that there are some predefined colours for PDF files, and custom colours can also be specified (take a look at page 193 of the above linked file).
Kind regards,
Stefan
-
- User
- Posts: 13
- Joined: Mon May 24, 2021 8:59 am
Re: Automation: Specific color for specific words in multiple PDFs
Thank you again for the fast reply.
I will start experimenting![Smile :-)](./images/smilies/icon_smile.gif)
I Still hope that it will be easy as with enhancing the code with "or", like:
... if (ckWord == "SearchWord" or "test" or "alpha") ...
.... strokeColor: color.green ...
... if (ckWord == "beta" or "gamma")
.... strokeColor: color.red...
Something like that.
However, in the long run, I would like to enhance this system via Excel (words, color, type (highlight or underline)). I will highlight / underline always the same words with the same colors. A system I can count on![Smile :-)](./images/smilies/icon_smile.gif)
I will start experimenting
![Smile :-)](./images/smilies/icon_smile.gif)
I Still hope that it will be easy as with enhancing the code with "or", like:
... if (ckWord == "SearchWord" or "test" or "alpha") ...
.... strokeColor: color.green ...
... if (ckWord == "beta" or "gamma")
.... strokeColor: color.red...
Something like that.
However, in the long run, I would like to enhance this system via Excel (words, color, type (highlight or underline)). I will highlight / underline always the same words with the same colors. A system I can count on
![Smile :-)](./images/smilies/icon_smile.gif)
-
- Site Admin
- Posts: 17960
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
Re: Automation: Specific color for specific words in multiple PDFs
Hello pdf-anna,
Here's some help with checking for one of a number of strings:
https://www.tjvantoll.com/2013/03/14/be ... le-values/
Kind regards,
Stefan
Here's some help with checking for one of a number of strings:
https://www.tjvantoll.com/2013/03/14/be ... le-values/
Kind regards,
Stefan
-
- User
- Posts: 1521
- Joined: Thu Feb 28, 2008 8:16 pm
Re: Automation: Specific color for specific words in multiple PDFs
Here's something related I wrote 10 years ago
https://forum.pdf-xchange.com/viewtopic.php?f=35&t=9945&hilit=reading#p45277
![Image](https://i.imgur.com/O5FQxwR.png)
Revolutionary Killer Feature for Power Reading
![Cool 8)](./images/smilies/icon_cool.gif)
https://forum.pdf-xchange.com/viewtopic.php?f=35&t=9945&hilit=reading#p45277
![Image](https://i.imgur.com/O5FQxwR.png)
Revolutionary Killer Feature for Power Reading
David.P
PDF-XChange Pro
PDF-XChange Pro
-
- User
- Posts: 13
- Joined: Mon May 24, 2021 8:59 am
Re: Automation: Specific color for specific words in multiple PDFs
@David P.,
this is exactly what I am looking for.
However, not browser based, but it should do it directly in my PDF and save this color coding.
Your homepage does not work anymore![Smile :-)](./images/smilies/icon_smile.gif)
this is exactly what I am looking for.
However, not browser based, but it should do it directly in my PDF and save this color coding.
Your homepage does not work anymore
![Smile :-)](./images/smilies/icon_smile.gif)
-
- User
- Posts: 1521
- Joined: Thu Feb 28, 2008 8:16 pm
Re: Automation: Specific color for specific words in multiple PDFs
True Anna, that web hosting went down years ago. I have corrected the link now ![Smile :)](./images/smilies/icon_smile.gif)
![Smile :)](./images/smilies/icon_smile.gif)
David.P
PDF-XChange Pro
PDF-XChange Pro
-
- Site Admin
- Posts: 17960
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
Re: Automation: Specific color for specific words in multiple PDFs
Hello David.P,
Thanks for bringing this up again, but I am afraid that for the time being we only have the tools and ways to achieve this discussed earlier!
Kind regards,
Stefan
Thanks for bringing this up again, but I am afraid that for the time being we only have the tools and ways to achieve this discussed earlier!
Kind regards,
Stefan
-
- User
- Posts: 1521
- Joined: Thu Feb 28, 2008 8:16 pm
Re: Automation: Specific color for specific words in multiple PDFs
Hello Stefan,
I understand that this is a rather advanced feature which is not that easy to implement.
However, the approach of how this feature was implemented as a browser plugin ten years ago, as well as possible further enhancements, particularly by including automatic keyword detection, can be looked up in the relevant thread in the Donationcoder forum, for those interested:
https://www.donationcoder.com/forum/index.php?topic=24496.msg222984#:~:text=Therefore%20I%20wish%20there%20was%20a%20software%20(or%20online%20service)%20that%20could%20do%20the%20following%3A
Best regards
David
--
PS: An online automatic "key sentences extractor" can be found here:
https://www.textcompactor.com
...and an automatic keyword extractor here:
https://wordcounter.net
I understand that this is a rather advanced feature which is not that easy to implement.
However, the approach of how this feature was implemented as a browser plugin ten years ago, as well as possible further enhancements, particularly by including automatic keyword detection, can be looked up in the relevant thread in the Donationcoder forum, for those interested:
https://www.donationcoder.com/forum/index.php?topic=24496.msg222984#:~:text=Therefore%20I%20wish%20there%20was%20a%20software%20(or%20online%20service)%20that%20could%20do%20the%20following%3A
Best regards
David
--
PS: An online automatic "key sentences extractor" can be found here:
https://www.textcompactor.com
...and an automatic keyword extractor here:
https://wordcounter.net
David.P
PDF-XChange Pro
PDF-XChange Pro
-
- User
- Posts: 13
- Joined: Mon May 24, 2021 8:59 am
Re: Automation: Specific color for specific words in multiple PDFs
Thank you all so far. But it seems to be that I will need to record a macro by doing the perfect mouse clicks step by step and save the process.
-
- Site Admin
- Posts: 1797
- Joined: Mon Jan 15, 2018 9:01 am
Re: Automation: Specific color for specific words in multiple PDFs
Hi all,
Unfortunately, we still do not have anything more to offer, so at this point, recording macro seems the be the best option.
Regards.
Unfortunately, we still do not have anything more to offer, so at this point, recording macro seems the be the best option.
Regards.
-
- User
- Posts: 13
- Joined: Mon May 24, 2021 8:59 am
Re: Automation: Specific color for specific words in multiple PDFs
I know, I am checking it all the time ![Sad :-(](./images/smilies/icon_sad.gif)
![Sad :-(](./images/smilies/icon_sad.gif)
-
- Site Admin
- Posts: 1797
- Joined: Mon Jan 15, 2018 9:01 am
-
- User
- Posts: 1521
- Joined: Thu Feb 28, 2008 8:16 pm
Re: Automation: Specific color for specific words in multiple PDFs
I would of course be most pleased with such a feature as well -- although admittedly, this feature currently is beyond advanced for any PDF software in existence.
I admit that I paid quite a bit of money for an Acr0bat plugin that makes this feature (partially) possible:
![Image](https://i.imgur.com/l4PdwHJ.png)
Now that I look it up again, I believe that this tool might even meet Anna's specific requirements, as can be seen here:
https://www.evermap.com/HighlightText.asp#:~:text=Search documents using custom text patterns,in the document without the need to specifically list all possible numbers.
@Tracker Team, I hope it is ok if I mention and link to a third-party product here. Since this feature is not available in PDF-XChange Editor (nor in any other PDF editor for that matter), I believe that the link should be ok for the time being.
One day we might even see a similar feature in PDF-XChange Editor!
Best regards
David
I admit that I paid quite a bit of money for an Acr0bat plugin that makes this feature (partially) possible:
![Image](https://i.imgur.com/l4PdwHJ.png)
Now that I look it up again, I believe that this tool might even meet Anna's specific requirements, as can be seen here:
https://www.evermap.com/HighlightText.asp#:~:text=Search documents using custom text patterns,in the document without the need to specifically list all possible numbers.
@Tracker Team, I hope it is ok if I mention and link to a third-party product here. Since this feature is not available in PDF-XChange Editor (nor in any other PDF editor for that matter), I believe that the link should be ok for the time being.
One day we might even see a similar feature in PDF-XChange Editor!
Best regards
David
David.P
PDF-XChange Pro
PDF-XChange Pro
-
- Site Admin
- Posts: 17960
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
Re: Automation: Specific color for specific words in multiple PDFs
Hello David.P,
Having the link is fine.
We know you are doing it to help Anna and others and not just to promote the product!
Kind regards,
Stefan
Having the link is fine.
We know you are doing it to help Anna and others and not just to promote the product!
Kind regards,
Stefan
-
- User
- Posts: 13
- Joined: Mon May 24, 2021 8:59 am
Re: Automation: Specific color for specific words in multiple PDFs
first of all, sorry for my late reply.
thank you for the idea david. i appreciate that.
to inform you all: i downloaded a free macro mouse recorder and replicated each step i have to do always manually. so now i click on play and just wait a few seconds.
dear support team, is there a shortcut for "highlight all"? so far is after "search", on the right sight preferences, the 4. from below - mark search results and then the 1. option "highlight".
these are a lot of mouse clicks but i prefer a keyboard shortcut for that.
thank you for the idea david. i appreciate that.
to inform you all: i downloaded a free macro mouse recorder and replicated each step i have to do always manually. so now i click on play and just wait a few seconds.
dear support team, is there a shortcut for "highlight all"? so far is after "search", on the right sight preferences, the 4. from below - mark search results and then the 1. option "highlight".
these are a lot of mouse clicks but i prefer a keyboard shortcut for that.
-
- Site Admin
- Posts: 17960
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
Re: Automation: Specific color for specific words in multiple PDFs
Hello pdf-anna,
Glad to hear you've found a solution that works for you with those macros!
You can create custom shortcuts for most of the commands in the Editor:
https://www.pdf-xchange.com/knowle ... the-Editor
And you likely need this command: Kind regards,
Stefan
Glad to hear you've found a solution that works for you with those macros!
You can create custom shortcuts for most of the commands in the Editor:
https://www.pdf-xchange.com/knowle ... the-Editor
And you likely need this command: Kind regards,
Stefan
You do not have the required permissions to view the files attached to this post.
-
- User
- Posts: 13
- Joined: Mon May 24, 2021 8:59 am
Re: Automation: Specific color for specific words in multiple PDFs
dear stefan,
i want to thank you so much for the hint.
this custom shortcut function is such a productivity boost. it makes macro recordings faster and less error-prone.
i want to thank you so much for the hint.
this custom shortcut function is such a productivity boost. it makes macro recordings faster and less error-prone.
-
- Site Admin
- Posts: 6903
- Joined: Wed Mar 25, 2009 10:37 pm
- Location: Chemainus, Canada
Automation: Specific color for specific words in multiple PDFs
![Smile :)](./images/smilies/icon_smile.gif)
Best regards
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com