I have an automated app which creates a set of outputs and sends them separately to the printer. Each page of the job is being sent as a separate print job which is undesirable, as it makes it almost impossible to use a PDF printer and convert create a single PDF file out of them.
I was wondering if there is a way to write a simple console or windows program that would receive these print jobs, merge them together and send the whole thing as one job to another printer. Is there anyway to accomplish that?
There are three ways I see to accomplish this.
The first would be to modify the original program. Have it drop PDFs off in a directory that is monitored by another program to do the combining.
The second is to install a PDF print driver whose output is a file on the file system. Every print job would output as a separate file. Your program would then monitor that and combine as necessary
The third way is to write your own print driver which takes the jobs and combines them.
However all of these "solutions" require you to be able to identify which page goes with which document and in what position of that document. Honestly, without far more information, the best route would be to modify the originating program to just do what you want.
It is not possible to merge print jobs, after they have been added to the queue.
What application is producing these documents?
What output format does it produce?
What is your intended output format and destination?
(printer/email/something else?)
Related
I'm working on a web-based KIOSK for in-house print jobs. We're a non-profit making small print publications. I've got a prototype created of portal that allows us to manage our publications (mainly PDFs), our print queues (mainly windows printers). I've been able to write C# code to use the FoxIt Reader to silently print PDFs from a RESTFUL API web service. It works. But in testing, I found serious limitations with the FoxIT Reader. Primarily, you can't specify how many copies to print, along with other basic settings. While it works, we often print in volume (50 or a hundred copies of multi-page PDFs. I could put in a loop to print the PDF N-times, but that's just ridiculous as it sends an ungodly amount of data and print jobs to the printer.
Anyways, I'm having difficulties locating a library (preferably open source) that gives me options for printing PDFs, specifiying things like # of copies, color / B&W, PRINTER MANAGES Color, etc.
I've been googling for a couple of days. I'm coming up empty. Those libraries I do come across are meant to work as WinForms foreground applications. What I need is an API that can Print PDFs as a background process (think windows service).
And just to be clear, by "Print PDF" I do not mean create a PDF. I mean take an existing PDF and sent it to a printer with options (# of copies, color/B&W, printer manages color, paper size, actual size vs. fit to paper size, orientation, etc.)
I really need some help. I'm coming up empty. Can anyone recommend an API that would help in this situation? The whole key I'm trying to avoid is FOREGROUND printing. I need to be able to spawn a print job as a background process, not interactive-user.
(My RESTFUL API web service takes an ID of a publication along with the quantity, page size, color mode (BW/Color)) and presently spawns a background print using FoxIt Reader. It does work. But without the options to specify quantity, page size, color/bw, PRINTER MANAGES Color, it's really useless for production.)
thanks in advance.
Please check out CLPrint. You have to either call the EXE directly or just place the PDF into a directory, but you can also specify the print options like you need. You should be able to run the process as any user.
http://www.terminalworks.com/command-line-printing
http://www.terminalworks.com/command-line-printing/downloads/documentation/CLPrintGuide.pdf (Page 6 are the command line options that I believe are relevant for you)
Is there any way in C# to get the documents sent to the printer from another program and use those documents again for something else?
I want to build an application which can get invoice sent to the printer by some point of sale system and gives opportunity to send that invoice to customer's email.
Well, you could print to the XPS printer and have it create a file. Then, let the system print the XPS file using the standard application. This may or may not work depending on some factors:
Is there XPS support on the system?
Did the user change the default application that handles XPS files? Maybe printing is no longer possible...
Is XPS a file format you want to send to the users?
etc.
That said, of course you could do the same thing with PDF, but you'd have to have access to an application that can actually print PDF. It has been asked multiple times here how to "send PDF bytes" to a printer - you can't. There are solutions, but in the end you have to answer this question for yourself:
Is it really worth the hassle or isn't it just easier to print the document and then create it again as PDF (for examples) to send to the user?
I need a way to print selected documents in a library from the ribbon. As I understand it, this will have to be done through scripting. So the main difficulty seems to be the fact that everything will need to be done client-side. Another not so tiny factor is that it has be a generic document printing button, not just for pdf or office documents.
Is there any way to tell the OS/browser to launch for each of the selected items/documents its appropriate program's printing options/window?
Also I want this to be generic to document libraries so I can't just map one as a remote disc.
Another solution that springs to mind is to transfer the selected documents to another document library under the care of an event handler that runs the neccessary c# commands for printing when a new item is added to said(hidden) document library.
Another thing that comes to mind is to basically reiterate what most print drivers already do with the Print to file option where they create a pdf document of the intended material then it would be just a matter of printing the created pdf. But then the printing applications already know the file they have is in the correct/accepted format and merely have to make the convertion to pdf.
Is there any way to use the OS to just open/print-to-file my document with the correct application?
Any help with the script or c# part would be great. Thank you.
The Goal
The company I work for currently uses a black box shipping system. Each morning our shipping manager prints out shipping tickets for his drivers. Using C#, I would like to save a copy of each ticket printed as a PDF. The action of saving to a PDF should be done behind the scenes.
Note: The PDF copy would be in addition to the hard copy, however, I would like to generate the PDF copy when the hard copy is printed (or directly after if I can use the saved print job).
End Result: The manager prints a hard copy and a PDF gets saved to an archive folder without any interaction from the manager.
What I've Tried
I've instructed the printer to "Keep printed documents" after printing. This leaves a .shd and a .spl file in the print spool folder. I've experimented with the PrintDocument class, but I can find no way to instruct a job to reprint (to a PDF driver) using a completed print job.
Question
Is what I'm trying to accomplish possible?
Further Clarification:
In case it wasn't clear, I do not want the manager to print the document a second time to a PDF print driver. On average he must print 60 tickets each morning before he can send his drivers out. I don't want to increase that number to 120 AND force him to type in the file names.
Additionally, the "black box" shipping system includes other modules that run other portions of our manufacturing plant - changing software is not an option.
I suggest you go with an existing solution to problems like this: Use a software that can install virtual printers that print the document on the printers you want. One such software is PrintDistributor. I don't have any experience with this software but the screenshot named "Virtual Printers" looks promising: The second printer is named "Print and save".
There is other software like this, see here.
According to your goal that you don't want to force him to enter file names, You should do this:
Use a PDF Printer software that provides automatic file naming, like these:
PDF Desk
Cute PDF
And tell the manager to print tickets just with that PDF Printer.
Then, write a c# or vb.net application. use FileSystemWatcher to detect if a new file is created in PDFs directory. and when a new PDF is created, print it.
Here are some tutorials that explains how to Print a PDF file in c#:
Print existing PDF (or other files) in C#
Printing PDF documents in C#
Trapping things being sent to the printer can be very tricky.
A simpler way would be to set up a 'pdf printer' using a piece of software such as:
http://www.bullzip.com/products/pdf/info.php
Configure this to output to a specific directory, and then write a windows service to monitor the directory and automatically send PDF files to the physical printer and archive the file off to a network folder.
[and remove the printer driver from his PC so he can't bypass your new system]
Issue two print commands... one to the paper printer, one to the PDF printer.
I have a situation where in a web application a user may need a variable list of PDFs to be printed. That is, given a large list of PDFs, the user may choose an arbitrary subset of that list to print. These PDFs are stored on the file system. I need a method to allow users to print these batches of PDFs relatively easily (thus, asking the user to click each PDF and print is not an option) and without too much of a hit on performance.
A couple of options I've thought about:
1) I have a colleague who uses a PDF library that I could use to take the PDFs and combine them on the fly and then send that PDF to the user for printing. I don't know if this method will mess up any sort of page numbering. This may be an "ok" method but I worry about the performance hit of this.
2) I've thought about creating an ActiveX that I would pass the PDFs off to and let it invoke the printing features. My concern is that this is needlessly complex and may present some odd user interactions.
So, I'm looking for the best option to use in this scenario, which is probably not one of the ones I've gone through.
The best solution I have for you is number 1. There are plenty of libraries that will merge documents. From the one I've used the numbering should not be an issue since all the pages are all ready rendered.
If you go with ActiveX you are going to limit yourself to IE which might be acceptable. The only other idea would be to use a smart client so you can have more control...then you could serve up the PDF's via a web service.
I think concatenating the documents is the way to go.
For tools I recommend iText#. Its free
You can download here iTextSharp
iText# (iTextSharp) is a port of the iText open source java library for PDF generation written entirely in C# for the .NET platform. Use the iText mailing list to get support.
I agree with #1. You could do some tests to see what the performance hit would be like.