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)
Related
I'm trying to generate a PDF that can be viewed interactively in Adobe Reader, but also, upon printing, selects different paper trays based on the page. (Some pages are supposed to use stationery, whereas other must not.)
PDF itself apparently doesn't support this form of metadata by design (as discussed e.g. here), but apparently, JDF is an appropriate format, and can be embedded as XML in the PDF.
What's less clear to me is if Adobe Reader does anything useful with that metadata: if a PDF with embedded JDF information is printed, does it parse the JDF and choose paper trays? Can I use PDF portfolios for this purpose instead?
My goal is to both let the user view the PDF in Adobe Reader interactively, and, upon printing, automatically selecting different paper trays.
(The far less convenient alternative would be to write a custom app to do the printing.)
You are right, PDF describes the artwork while the JDF describes the metadata about print. However, JDF is targeted to industrial printing systems rather than for desktop printers. As far as I know does Adobe Acrobat Reader not support this kind of feature based on a JDF.
In order to control the different paper trays of your printer, you may setup your printer several times - one for each tray and switch the flag "default printer" in the background programmatically.
Another idea could be to use the Acrobat Reader only for viewing purposes and using the command line for printing.
There are concepts of how to put metadata into the PDF directly (see: https://confluence.cip4.org/display/PUB/PDF+Intent), but it could take a while until this specification is gonna to be implemented.
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?)
It seems like there should be more information on this, but I can't seem to find the right words to search by.
Basically, I have a C# application that prints off a filled out form. I take user input and draw them over a image of the form then print it off. This application works perfectly for all but one of the workstations that use it.
The text on the form doesn't print in the correct location, rather it seems to be offset by and additional .25" on the x and y axis while the image of the form prints of perfectly. All workstations print to the same shared printer and use the same application.
I'm not sure what settings would cause the printer to print the text in a different location.
Is there a way to configure my application or the users workstation so I won't need to created a "personalized" version of the application for that workstation?
Thank you for help.
If you can't find the reason in different drivers or resolutions, an alternative might be to generate a PDF and then send that to the printer. That way you have control of the output page and can preview it as well. There are many libraries for generating PDF files. If you're generating HTML, you can use the free wkhtmltopdf to convert from HTML to PDF. I'm sure there are many others as well. Good luck!
We are generating PDFS from a web app a couple different ways, ItextASharp, Html->Rotativa, and RDLC...
Is there any way in anyof those tools to modify the ViewerPreferences dictionary inside the PDF so as to disable the "shrink to fit" option..
The PDF format supports this option, I've found documentation for that...
I'm aware that not all viewers honor the request not to shrink to fit, but we're using stock adobe readers across the board so it's ok.
I was able to find this in ITextSharp to read one, modify it and save, it, so I have to believe there is a way to set it before generation...but I can't find it..
Determine properties such as if PDF is Simplex or Duplex in iTextSharp
It'd be awesome if Rotativa had a way too...since we use that for some reports
We also have some done in RDLC style, if there is a way to do it there...
The reason we have to do it, is one of our apps prints labels and the amount of data leave no room for fudging it. Printing them from a web app is problematic, even when we control the ecosystem.
Unfortunately, our IT group will not use the reg settings to change the default on the machines.. we have to do it through code.
I've searched Stackoverflow and google and found many ways
how I can print stuff in C#.
The best way for me would be to populate blank white windows form
with some label, textbox and picturebox elements and print it as a windows form.
This way is very poor because it prints in 72 DPI, and is not flexible for multiple
pages print.
Next way that I found that would be good is using iTextSharp, but there is a problem
that iTextSharp only generates PDF-s, and you have to open it in PDF viewer and print
from there.
I love this way of thinking where I create a paragraph, and then fill it with text and graphic, so I found this thread
http://www.devarticles.com/c/a/C-Sharp/Printing-Using-C-sharp/
where it discusses how to create your own printing engine in C#, something like iTextSharp,
but very lightweight...
Now that I've said that, I want to know is there any ready to use printing engine that would be like iTextSharp, made for printing, not for PDF generation? What is the best way to print something, without using reporting services like CrystalReports.
I think Crystal Reports wouldn't work for my case cause I don't want to print generic reports, but some text and graphics that I need to dynamicaly generate every time I need to print.
I found that it was much easier to do printing using the printing stuff in WPF.
EDIT
XPS is the page description format that Microsoft included into .NET with .NET 3.0. It is nominally part of WPF, and is integrated with the WPF form layout model. But you can create XPS documents in memory and send them to printers, from any .NET app, including a WinForms App.
An example:
http://statestreetgang.net/post/2008/03/Creating-an-XPS-document-in-memory-via-the-DOM.aspx
It is approximately equivalent to the iTextSharp capability you explored, except:
you can do it all in memory if you like, no need to save to a filesystem file. Of course if you want to save to a filesystem file, you can do that too.
you don't need an external viewer in order to start the print.
If you are new in programming and you have some data like from Data Base, and you want to print it after retrieving it from Data Base. Then just follow this link it will guide you step by step.
Print Data in Dot Net (C#,Vb.net)