Print, crop and text recognition protected 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

biofunc
User
Posts: 13
Joined: Tue Mar 03, 2020 6:35 am

Print, crop and text recognition protected PDF

Post by biofunc »

Hello,
I will do in PDF tools in one go:
- print a protected file (printing allowed) with „Select Paper Size by Documents Page Size“
- save overrite original or, if that doesn't work: with a number at end of filename
- crop to white margins
- text recognition
- save
I can do this in individual steps in the PDF editor, but I can't do it in PDF tools.
Is there a solution?

Best regards
biofunc
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8624
Joined: Wed Jan 03, 2018 6:52 pm

Re: Print, crop and text recognition protected PDF

Post by TrackerSupp-Daniel »

Hello, biofunc

If you are opening the file and immediately printing, I dont understand the need to save it again afterwards, but that would be possible (if unnecessary) since printing does not make changes to the original file.

You can create your own custom tools at any time by following the steps here: https://www.pdf-xchange.com/knowle ... -PDF-Tools

I have attached a sample tool configured to do this. As you request, you simply
1. choose an input file
Then the tool will:
2. print a copy (you will want to configure which printer to use, the other options to fit to margins, auto-rotate on page, and select paper by sheet size are enabled)
3. Save the file to the source folder, overwriting the original if present (I do not believe it is necessary, but it is present and configured nonetheless, you can delete the action from the tool via Edit if you would like)
4. Crop white space from each page (note that this will result in some pages having varying paper sizes).
5. run OCR to generate "Searchable text" in sections of the document which do not already contain any other form of text.
6. save a final copy of the document to the source folder, appending "Complete" and a number if there is already another file by the same name present.

Note that normally we do not offer services to create custom tools like this, and you will need to do so yourself. In this case, I needed to test and confirm it actually was possible, so you could say that I had it handy, Enjoy!
sample tool for biofunc.zip
Kind regards,
You do not have the required permissions to view the files attached to this post.
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
biofunc
User
Posts: 13
Joined: Tue Mar 03, 2020 6:35 am

Re: Print, crop and text recognition protected PDF

Post by biofunc »

Hi Daniel,

first of all, thank you very much for your quick reply.

Your example tool corresponds almost exactly to the one I created myself ;-)

2. print a copy (you will want to configure which printer to use, the other options to fit to margins, auto-rotate on page, and select paper by sheet size are enabled)
Yes, it works and at the end of the printing process I am asked to save the file (see #3). I was hoping to skip this prompt and directly overwrite the original file.

3. Save the file to the source folder, overwriting the original if present (I do not believe it is necessary, but it is present and configured nevertheless, you can delete the action from the tool via Edit if you would like)
Yes, it is saved under #2 and then it does not have to be saved again. That's what I meant. Excuse my bad English.

From #4 onwards it no longer works with a protected file.
4. Crop white space from each page (note that this will result in some pages having varying paper sizes).
You have selected “Fit to Printer Margins”. I'd be happy to take over and then No. 4 can be omitted.

5. run OCR to generate "Searchable text" in sections of the document which do not already contain any other form of text.
6. save a final copy of the document to the source folder, appending "Complete" and a number if there is already another file by the same name present.

I am attaching an example of a file that is publicly available on the Internet. The aim is to turn protected files into an unprotected, text-searchable file via printing. The original file can be overwritten.

Best regards
biofunc
1.pdf
You do not have the required permissions to view the files attached to this post.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17960
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: Print, crop and text recognition protected PDF

Post by Tracker Supp-Stefan »

Hello biofunc,

Leaving aside that you are trying to remove protection from a file that has it for a reason - have you considered saving copies of the files with the exact original names - just in a second folder (it could even be a subfolder of the one where the source files are) - that way you won't have to worry about overwriting and prompts to save the files - and can then have all your files in one folder for easier management once processed.

Kind regards,
Stefan
User avatar
Vladimir G - Tracker Dev
User
Posts: 41
Joined: Thu Nov 30, 2017 1:24 pm

Re: Print, crop and text recognition protected PDF

Post by Vladimir G - Tracker Dev »

Hello, biofunc
biofunc wrote: Fri Sep 22, 2023 11:19 am 2. print a copy (you will want to configure which printer to use, the other options to fit to margins, auto-rotate on page, and select paper by sheet size are enabled)
Yes, it works and at the end of the printing process I am asked to save the file (see #3). I was hoping to skip this prompt and directly overwrite the original file.
Some print-to-PDF drivers offer an option to configure and select the output folder without displaying the 'Save as...' dialog every time, and PDF-XChange Printer provides this functionality. To configure it, click on the 'More options...' label under the gear icon on the Print Documents action's dialog. Then, navigate to the 'Save' section, uncheck the 'Show 'Save as...' Dialog' option, and configure the 'Path' field below.

Unfortunately, the Print Document action was not designed to serve as an intermediate step. This results in the following limitations:
1. The Print Document action does not pass its output to the next action in the sequence. Consequently, the next action, whatever it may be, cannot access the exact document produced by the Print Document action.
2. We cannot guarantee that the printed document will be saved before PDF Tools proceeds to the next action.

I cannot suggest a tool configuration that is flexible enough. Maybe, you can consider using two separate tools that you will have to run manually one after the other, or using the Folder Monitors feature, but then you will have to refuse the idea of performing everything 'in place' with overwriting source documents, etc.

Best regards,
Vladimir Goshko
Software Developer
Tracker Software Products
biofunc
User
Posts: 13
Joined: Tue Mar 03, 2020 6:35 am

Re: Print, crop and text recognition protected PDF

Post by biofunc »

Hello Vladimir,

Thank you for this useful information!

I implemented your proposal for working with two steps and it works very well.

Best regards

biofunc
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17960
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Print, crop and text recognition protected PDF

Post by Tracker Supp-Stefan »

:)