Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>While I can't answer your question specifically, I found that I couldn't do this as Adobe changed Reader I think at version 9 or 10 so that you couldn't supress the print dialog, and the window itself kept coming up anyway, and since my users all had different versions of Reader installed I couldn't get anything consistently working. If you want to try anyway have a look at Reader's API - you need to add a reference to the correct COM library and go from there. Painful.</p> <p>I ended up dropping Adobe completely by running the PDF through <a href="http://ghostscript.com/">GhostScript</a>. Following is the helper class I created to do the job. <code>gsExePath</code> should be something like <code>C:\Program Files\gs\gs8.71\bin\gswin32c.exe</code>.</p> <pre><code>public class GSInterface { public string GhostScriptExePath { get; private set; } public GSInterface(string gsExePath) { this.GhostScriptExePath = gsExePath; } public virtual void CallGhostScript(string[] args) { var p = new Process(); p.StartInfo.FileName = this.GhostScriptExePath; p.StartInfo.Arguments = string.Join(" ", args); p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; p.Start(); p.WaitForExit(); } public void Print(string filename, string printerName) { this.CallGhostScript(new string[] { "-q", "-sDEVICE=mswinpr2", "-sPAPERSIZE=a4", "-dNOPAUSE", "-dNoCancel", "-dBATCH", "-dDuplex", string.Format(@"-sOutputFile=""\\spool\{0}""", printerName), string.Format(@"""{0}""", filename) }); } } </code></pre> <p>The following should print to the Windows default printer:</p> <pre><code>var printerName = new System.Drawing.Printing.PrinterSettings().PrinterName; var gs = new GSInterface(gsExePath); gs.Print(filename, printername); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload