GHOSTSCRIPT SILENT PRINT PDF

Print you PDF silently using C#; Author: ; Updated: 14 Mar ; we’ll use the suite of software Ghost Script developed by Artifex and. 2) using gsprint, a executable that comes with Ghostview (the GUI for GhostScript ) and who’s able to send PS and PDF files to any printer that. or uninstaller silently, /D sets the default installation directory (It must be . To print to a specified queue, use -sOutputFile=\\spool\NullLPT1.

Author: Fenrigul JoJogor
Country: Gambia
Language: English (Spanish)
Genre: Art
Published (Last): 5 February 2005
Pages: 55
PDF File Size: 15.7 Mb
ePub File Size: 3.9 Mb
ISBN: 393-2-59676-186-7
Downloads: 53637
Price: Free* [*Free Regsitration Required]
Uploader: Goltilkis

Background printing of PDF documents

I was asked to create some software to handle printing of PDF documents and after scouring the Internet for several hours I realized that this wasn’t as easy as I had initially though. There are several methods of doing background printing so I tested all I could find and measured the performance.

This implementation was going to be a Windows service written in C which could pick up newly created files in a directory, do some processing and then print them. The service needed to be threaded to be able to handle multiple files at the same time so I was looking for thread safe components. Another thing high up on the wishing list was the use of open source or free software. The performance testing was done by giving the service 40 single page PDF documents and measuring the time taken until the last file was processed and sent to the printer queue.

Version 6 of Adobe Reader supported command line printing; sadly this was removed in newer versions. I could still launch the application using System. Process class and supplying the “PrintTo” verb so I tested this.

Using one thread to print all 40 documents took about 12 minutes with this method. There was however several problems using this method:. This method solves all problems I had with Adobe Reader but unfortunately introduces new ones. Ghostscript has a command line interface gswin32c.

There were no problems using several threads and memory usage seemed to be acceptable. The problem with using Ghostscript was processing time and the size of the spooling file sent to the printer.

In some cases the file size difference between Ghostscript and Adobe Reader was a factor of Also, when printing documents with several pages Ghostscript seems to process each page individually.

This took way too much time. This method was however twice as fast as Adobe Reader when printing the 40 test documents and finished in about 6 minutes. I can’t begin to explain the frustration I felt using their so called SDK and in the end I can’t recommend it to anyone. To be able to use their APIs you need to install the full Acrobat package which is a hassle to obtain just to test it out. Second, the SDK is.

NET compatible but not much more. Their class structure is a complete mess and horrible to work with. Third, there is no apparent way of supplying the destination printer using the APIs.

  ESPONDILOLISTESIS TRAUMATICA PDF

There is a PrintPagesSilent method but it always prints to the default printer. Somewhere in some developers manual I found out that you have to go through JavaScript to be able to set a destination printer, which is completely insane.

Why not add it as an optional parameter to the PrintPagesSilent method? We could of course change the default printer but that wouldn’t be thread safe. Finally I tested printing with Foxit Reader which is freely available at www.

It has a command line interface for printing, uses less memory than the previous alternatives and it’s also thread safe. When printing the 40 test documents using 3 threads, all documents were processed in less than 1 min 30 sec. Using the command line Foxit Reader will exit after printing the document. The printer name must be supplied exactly as written in the standard Windows print dialog.

This was a minor problem because the printer name supplied with the files was actually the share name. Therefore I wrote a method which fetches all installed printers and matches the names. In order to handle installed printers two basic classes were created: The Printer class basically contains two strings to store printer name and share name. The PrinterList class is a subclass of System. List to hold the instances of Printer and also to do various finding tasks. Background printing of PDF documents isn’t very difficult once you have found the right tools for the task.

Ghostscript works fine when printing small documents and it’s highly customizable. Sadly Ghostscript will choke when you give it larger documents. Spooling a PDF containing 60 pages using Ghostscript takes minutes instead of a couple of seconds using alternative methods. Thank you Tobias I also fond that this solution with Foxit worked well for me too. I had tried Sumatra with no luck.

I did notice that the executable name changed slightly so I had to remove a space. So far everything else seems to be working for my simple needs. Is there a way to specify the tray in the command line argument? Any other idea to dynamically indicate the tray a document should get the paper. You can also read an interesting c acrobat remove text from pdf on this page http: Depending on your requirements, there can be a very easy way to print a PDF from code. Now all you need to do us use a file copy method, like C ‘s File.

Copy and copy your PDF into that queue as if it were a simple file share.

Silent Print Using C#

The file will now print fine. This works on PDF, txt, maybe others, but not on word docs, excel, etc. Dear sir, I have also tested the same and I find pfint same.

Now the problem is, when I want to print multiple copies of same pdf using foxit reader, there is no command line argument for that. Please help me out from this situation.

  DRAMIN B6 GOTAS BULA PDF

It prints silently which is great using command line but I only get empty pages.

I can open the PDF file first and print from the main window, but still empty pages. I googled around and found a lot of discussions around this problem since I just found Sumatra PDF http: That’s great information BP, I’ve never run into that problem myself but please keep us posted if you find a solution. Beware that if you are looking for a total background, unattended solution, that if the document requires a password or is unopenable for some reason, foxit will throw up a dialog and the process will remain locked until the dialog is dismissed.

For running in an unattended environment it would be best for this to be returned from the process as an error, which it is not. I have not found a solution to this issue yet but will try to drop any hints I find here if I remember.

WPDOS – Print to Any Windows Printer: Ghostscript Method

Using Adobe Reader Version 6 of Adobe Reader supported command line printing; sadly this was removed in newer versions. There was however several sient using this method: Adobe Reader will not close after the file has been printed and there is no easy way of determining when the application is finished printing.

We could wait for a fixed time or wait until the application is idle and then kill it. I decided to wait until the application was idle which worked satisfactory. Adobe Reader does not seem to be thread safe. When using two or more threads, files sent to Adobe Reader at the same time was ignored. There seemed to be a lot of memory overhead gnostscript launching Reader.

These problems led me to continue searching for other solutions. Using Ghostscript This method solves all problems I had with Adobe Reader but unfortunately introduces new ones. Finally, they charge you money for this Ghlstscript startInfo ; proc. Post your comment Name required Comment required Please enter a number between and 14 Comments newest first Posted by Dan on May 9, Posted by ayala on March 30, Posted by icaro on June 2, Posted by lorretadt on May 3, Posted by lorretadt on April 20, Posted by Forumisto on March 27, Posted by Marcus on May 13, Posted by Saurabh on April 29, Posted by fretje on February 24, Posted by miliu on January 17, Posted by Brian on October 24, Posted by Tobias on June 1, Posted by BP on May 29,

Posted in <a href="http://santovec.us/category/automotive/" rel="category tag">Automotive</a>