Save all print jobs as PDF

goal

The company I work with currently uses a black box delivery system. Every morning our delivery manager prints tickets for the delivery of their drivers. Using C #, I would like to keep a copy of each ticket printed in PDF format. The save action in PDF should be performed behind the scenes.

Note : a copy of the PDF will be in addition to the printed copy, however I would like to create a copy of the PDF when the printed copy is printed (or immediately after if I can use the saved print).

The end result . The manager prints a hard copy and the PDF file is saved in the archive folder without any interaction with the manager.

What i tried

I instructed the printer to keep printed documents after printing. This leaves the .shd and .spl file in the print queue folder. I experimented with the PrintDocument class, but I cannot find a way to reassign the job (to the PDF driver) using the completed print job.

Question

Am I trying to do this?

Further clarification :

If this was unclear, I do not want the manager to print the document twice in the PDF driver. On average, he needs to print 60 tickets every morning before he can send his drivers. I do not want to increase this number to 120 And force it to enter file names.

In addition, the β€œblack box” delivery system includes other modules that use other parts of our manufacturing enterprise β€” no plug-in software.

+4
source share
4 answers

I suggest you move on to the existing solution to such problems: use software that can install virtual printers that print the document on the required printers. One such program is PrintDistributor . I have no experience with this software, but a screenshot with the name "Virtual Printers" looks promising: the second printer is called "Printing and Saving".

There is other software here , see here .

+3
source

According to your goal, that you do not want to force it to enter file names, you should do this:

Use PDF printer software that provides automatic file naming, for example:

PDF Desk

Nice pdf

And ask the manager to print tickets only with this PDF printer.

Then write a C # application or vb.net. use FileSystemWatcher to determine if a new file has been created in the PDF directory. and when a new PDF file is created, print it.

Here are some guides that explain how to print a PDF file in C #:

Print existing PDF (or other files) in C #

Printing PDF documents in C #

+2
source

The trap sent to the printer can be very complex.

The simplest way would be to create a "pdf printer" using software such as: http://www.bullzip.com/products/pdf/info.php

Configure this to output to a specific directory, and then start the Windows service to control the directory and automatically send PDF files to a physical printer and archive the file to a network folder.

[and remove the printer driver from your PC so that it cannot bypass your new system]

+1
source

Issue two print commands ... one to a paper printer, one to a PDF printer.

0
source

Source: https://habr.com/ru/post/1384150/


All Articles