Automating/executing a workflow via virtual printer

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
Andrew84
User
Posts: 5
Joined: Wed Mar 30, 2022 12:57 pm

Automating/executing a workflow via virtual printer

Post by Andrew84 »

Hello,

I created a workflow with PDF Tools that, when executed, separates the pages of a PDF file into separate files via a PDF printer, and then prints these separate files multiple printers. This works fine. However, we always have to start PDF Tools and execute the workflow manually.
Apparently it is possible to create a printer and, when printing the file with it, will execute the workflow. However, I was unable to figure out how to do that. Can anyone tell me?

Also, another strange thing: we noticed that when a page is in landscape format, it looses its OCR data on separation. Is there a setting for that?

Best regards
~Andrew
Last edited by Andrew84 on Thu Mar 31, 2022 9:57 am, edited 1 time in total.
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6813
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: Automating/executing a workflow via virtual printer

Post by Paul - Tracker Supp »

Hi Andrew,

thanks for the post.

Perhaps you can explain a little more about your process.

May I ask why you are reprinting the PDFs? PDF-Tools can separate/split the pages of PDFs without reprinting them. Reprinting PDF to PDF is typically best avoided where possible as it can strip interactive content from documents.

Is it that you are printing tp PDF to initially get the PDFs from another format and then you want to have the creation of these PDFs trigger the separation of pages?

Sorry if I am missing something obvious here. Maybe send us the tool you created? You can export your custom Tool and send it to us if you zip the file first.
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Andrew84
User
Posts: 5
Joined: Wed Mar 30, 2022 12:57 pm

Re: Automating/executing a workflow via virtual printer

Post by Andrew84 »

Paul - Tracker Supp wrote: Wed Mar 30, 2022 4:16 pm Hi Andrew,

thanks for the post.

Perhaps you can explain a little more about your process.

May I ask why you are reprinting the PDFs? PDF-Tools can separate/split the pages of PDFs without reprinting them. Reprinting PDF to PDF is typically best avoided where possible as it can strip interactive content from documents.

Is it that you are printing tp PDF to initially get the PDFs from another format and then you want to have the creation of these PDFs trigger the separation of pages?

Sorry if I am missing something obvious here. Maybe send us the tool you created? You can export your custom Tool and send it to us if you zip the file first.
Hi Paul,

I set it up this way because I was following a manual I received. However, I believe I misspoke. The tool separates the pages before they are printed. I attached the file below. Please note that I set the pages to print through a PDF printer. This is for testing purposes and I will change these to physical printers once it works as intended.

Best regards
Last edited by Andrew84 on Mon Apr 04, 2022 8:57 am, edited 3 times in total.
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8371
Joined: Wed Jan 03, 2018 6:52 pm

Re: Automating/executing a workflow via virtual printer

Post by TrackerSupp-Daniel »

Hello, Andrew84

I see that you have two separate "choose input files" steps in this tool, That alone will cause some complications and result in potentially unpredictable behaviour. What I would suggest is that you make these into two separate tools, instead of a single tool, to simplify the processes, and avoid complications.

Beyond that, the tool(s) each appear to be properly configured for general use. You were asking about setting up PDF tool to automatically process files. That would be done using a "folder monitor". The process for doing so is detailed here: https://www.pdf-xchange.com/knowle ... -PDF-Tools

Please let me know if that was unclear or if you have additional questions.

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
Andrew84
User
Posts: 5
Joined: Wed Mar 30, 2022 12:57 pm

Re: Automating/executing a workflow via virtual printer

Post by Andrew84 »

TrackerSupp-Daniel wrote: Thu Mar 31, 2022 5:20 pm Hello, Andrew84

I see that you have two separate "choose input files" steps in this tool, That alone will cause some complications and result in potentially unpredictable behaviour. What I would suggest is that you make these into two separate tools, instead of a single tool, to simplify the processes, and avoid complications.

Beyond that, the tool(s) each appear to be properly configured for general use. You were asking about setting up PDF tool to automatically process files. That would be done using a "folder monitor". The process for doing so is detailed here: https://www.pdf-xchange.com/knowledgebase/544-How-do-I-set-up-Folder-Monitors-in-PDF-Tools

Please let me know if that was unclear or if you have additional questions.

Kind regards,
Hello Daniel,

it seems there's a slight misunderstanding. I may have phrased wrong. I apologize for that, English is not my first language.
Here's how we'd like it to work in detail:
1) A website generates a PDF file. This file is basically two parts - the first half is pages with information, the second half is labels.
2) A user prints the PDF file from the browser. This printer is supposed to execute the tool. That's what I meant with automation.
3) The amount of information pages varies, the amount of labels is always the same. Since we can't count pages starting with the last, we use OCR data to identify when the labels begin - the information will be printed on one printer, the labels on another.
The problem is that the labels must be printed in landscape format, so they must be rotated. However, that removes the OCR information, meaning we can no longer separate them.

Also, I was just informed that the tool I attached is actually outdated. I will try and see if I can get the current one, I was not aware that it was changed. This may take a while, however, as it is on a different location and their internet is currently down due to ISP issues.

Best regards
~Andrew
Last edited by Andrew84 on Mon Apr 04, 2022 7:59 am, edited 1 time in total.
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6813
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: Automating/executing a workflow via virtual printer

Post by Paul - Tracker Supp »

Thanks Andrew for the extra detail.

while we wait for you to dig up the new tool, I would like to ask about the high level process. I wonder if there might be a better way to achieve your desired outcome.
1) A website generates a PDF file. This file is basically two parts - the first half is pages with information, the second half is labels.
OK - so far so good. There is nothing we can/would change here.
2) A user prints the PDF file from the browser. This printer is supposed to execute the tool. That's what I meant with automation.
This I am keen to discuss. Again you use the term "Prints the PDF" and I need to know if this really is printed or are you saving the PDF form the server? If the file is already a PDF then it is counter productive to print it to PDF again, it achieves little more than stripping interactive features. If you actually are saving the PDF at this point it would be, I anticipate, better than printing to PDF. Can you confirm what is actually happening at this stage? Are you saving the PDF for processing or actually re-printing it?
3) The amount of information pages varies, the amount of labels is always the same. Since we can't count pages starting with the last, we use OCR data to identify when the labels begin - the information will be printed on one printer, the labels on another.
What are you using for the OCR? Rotating pages should not remove the OCR content.

It occurs to me that you should be able to do all this directly within PDF-Tools, however there currently is no way to define the last N pages of a PDF, all our page range options are relative to the first page, so I raised a Feature Request for Tools to be able to perform operations on the last N pages of a PDF. RT#6009: Feature Request :: PDF-Tools :: extract last N pages

My thinking is that if you get a PDF to start with, you should be able to simply split them into "the last N pages" and "the rest", and that would remove the need for printing and OCR. That, if it is appealing to you, would not be available until the feature is implemented and at the moment it is considered low priority.

So I have kind of gone in two directions here, one, we need to know how you are performing the OCR and whether you are using our OCR, and two, maybe a simplified process for the future.

I am keen to hear about the OCR and your thoughts on making this a less complex process.
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Andrew84
User
Posts: 5
Joined: Wed Mar 30, 2022 12:57 pm

Re: Automating/executing a workflow via virtual printer

Post by Andrew84 »

Hello Paul,

the new tool is attached here.
PDF-Tools Exchange 2022-04-04.zip
(3.18 KiB) Downloaded 37 times
It is the current version but it was created in february. My colleague isn't entirely certain anymore what he did. I know he tested some stuff, that's why there might be redundant or deactivated commands.

Concerning 2) the quality of the PDF files is not an issue, as long as the print on paper is readable.
Saving the PDF and have the software check a directory for files would probably work, but how long would that take? The employees need the file on paper as soon as they can open it in the browser, so they don't have to wait for it. They're used to the process of printing it, that's why we originally went with that. However, if you have any idea how to make this simpler and more reliable, I'm all for it.

Concerning 3) the OCR information is already in the document generated by the website. The OCR recognition is done in the "filter page" command. The PDF printing and page rotation is done with Tracker's PDF printer. We tested and OCR information is certainly lost after rotation.

It would be awesome if counting from the last page was a feature, alas we can't postpone this until it is implemented. Thus the only ways I can think of is either OCR, or to separate the PDF into pages, recombine them in reverse order and then do the separation of N pages from the first. That is, if recombination in reverse order is possible. Of course, that would make it more complicated again.

EDIT: One question: would it be possible to have the PDF printer print the pages in reverse order? Then we wouldn't need the OCR info and we only need to do the automation.

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

Re: Automating/executing a workflow via virtual printer

Post by TrackerSupp-Daniel »

Hello, Andrew84
Andrew84 wrote: Mon Apr 04, 2022 8:05 am Concerning 2) the quality of the PDF files is not an issue, as long as the print on paper is readable.
Printing would not generally reduce the visual quality of the document, it should look nearly identical to the original in nearly all cases. But, printing a PDF to PDF does, in most cases, change the type of content present, a "form field" will become a rectangle with base content text inside it, all comments will be flattened, stamps will become images or a free-floating group of random objects, digital signatures will be removed, etc. In some cases, such as when printing from a browser all of the text content could be converted to "shapes" (preventing you from using text editing features entirely). That is why we do not recommend printing an existing PDF to PDF and instead suggest simply saving the document locally.
Andrew84 wrote: Mon Apr 04, 2022 8:05 am Saving the PDF and have the software check a directory for files would probably work, but how long would that take? The employees need the file on paper as soon as they can open it in the browser, so they don't have to wait for it.
There should actually be less of a delay with saving the file locally, compared to printing. When you try to print a file from a web browser, the entire file is downloaded and saved to a hidden directory that only the browser can use, after that it is re-formatted, sent to the printer for processing, and forgotten by the browser. Then the printer will perform its steps, and in the case of a virtual printer, go through the process of creating a brand new PDF document with the appearance that was sent to itself. Finally after all of that, you are prompted to save the file, and then can open it up.
Printing not only takes much longer, but it requires many more steps. When you download a document, it is quite simply, save the file to a local folder you can access, double click that file to open it. From there you can do as needed with the file.

Now, Our printers do not offer the ability "kickstart" an automated workflow. The features that they offer are the features that are present, anything more than that is not part of the package, If you need to automate a processing with a PDF document, or even more so, begin batch processing multiple files, than PDF-Tools is a much better application for those needs, and should be the first point to consider, It offers dozens of custom actions which can be organized to create your own custom tools and workflows, as well as folder monitor capabilities to fully automate the actions being taken. I know you have a custom tool already made, but if you wish to further refine that yourself, you can find out more about tools by checking the hyperlinks in my text above.
Andrew84 wrote: Mon Apr 04, 2022 8:05 am Concerning 3) the OCR information is already in the document generated by the website. The OCR recognition is done in the "filter page" command. The PDF printing and page rotation is done with Tracker's PDF printer. We tested and OCR information is certainly lost after rotation.
This right here (along with the "printing PDF to PDF, especially from a browser" altering the content of the file), is the crux of the issue I suspect. As I mentioned above, printing PDF to PDF can change the content. If you have enabled print as images from the printing application, that would certainly remove the text content. Beyond that, even if you don't choose to print as an image, newer versions of popular web browsers (Firefox, Edge, Chrome, etc), will do a sneaky little thing when printing. They convert the text into "shapes" before sending it to the printer. This is very helpful for physical printers, as it reduces the expectancy that the printer is aware of, or able to process, the various fonts that may be present in the document. This speeds up printing and makes physical printers better to work with. Conversely, this causes issues for virtual printers, as we are not given any font information to work with we cannot place regular text in the output file, thus the prior OCR data is lost.
This is another situation where saving the document locally, and then using either the Editor, or PDF-Tools to rotate the page would be a much better way to handle the situation. If the Editor or PDF-Tools is rotating the pages, all content will be retained as is, and rotate with the page, so it would not be possible to lose the OCR information this way.
Andrew84 wrote: Mon Apr 04, 2022 8:05 am EDIT: One question: would it be possible to have the PDF printer print the pages in reverse order? Then we wouldn't need the OCR info and we only need to do the automation.
The printer cannot be configured to reverse pages, but you can accomplish a page reversal within the Editor by using a handy little bit of JavaScript. Sadly, PDF-Tools cannot yet handle JS, so this will need to be done manually using the Editor, we have made this into a single click button to make it a bit easier for you.
Reverse page order.zip
(421 Bytes) Downloaded 34 times
**Important note** As I was trying to upload this, Windows defender looked it over and incorrectly assumed it was a Trojan, then promptly quarantined the file. After you change the extension to *.js (detailed below) you may need to add an exception in Windows defender for this false positive.
Simply unzip this file into the following directory:

Code: Select all

C:\Program Files\Tracker Software\PDF Editor\JavaScripts
And then change the file extension from *.txt to *.js.
Next time that anyone launches the Editor on the PC (it will not appear if the Editor is running when you drop the file in the folder), they will see a new "add-on tools" tab appear on the far right of the editor, which contains a single tool "reverse page order". A single click of that tool will invert the pages in the document.

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
Andrew84
User
Posts: 5
Joined: Wed Mar 30, 2022 12:57 pm

Re: Automating/executing a workflow via virtual printer

Post by Andrew84 »

TrackerSupp-Daniel wrote: Wed Apr 06, 2022 5:01 pm Hello, Andrew84
...
Hello Daniel,

first of all, my apologies for not replying for so long. I was out of office for a while due to health issues. While I was out, the customer decided to go a different route and use a workflow management system that will apparently be able to do what they want. They may still try to go back to PDF-Tools should the WMS not be performant enough, but for the moment I was told to not pursue the project further.

I would like to thank you for your extensive reply and the effort you put into it, and thanks to Paul as well.

Best regards
~Andrew
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6813
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: Automating/executing a workflow via virtual printer

Post by Paul - Tracker Supp »

Understood Andrew,

thanks for the kind words. We are not the right tool for every purpose. We appreciate that you tried PDF-Tools for this and wish you all the best in your endeavour.

cheers
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Post Reply