Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4242936
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:30:36+00:00 2026-05-21T03:30:36+00:00

For reasons I can’t get into right now, I need to prevent the Adobe

  • 0

For reasons I can’t get into right now, I need to prevent the Adobe Reader window from opening up when I try to print a document. The developer that was working on this before me has the following flags set, although I’m not really sure what they’re for –

if (RegistryManager.GetAcrobatVersion() >= 9.0f)
    printerArg = "\"" + printerName + "\"";
else
    printerArg = printerName;

Process myProc = new Process();
myProc.StartInfo.FileName = fileName;
myProc.StartInfo.Verb = "printto";
myProc.StartInfo.UseShellExecute = true;
myProc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
myProc.StartInfo.CreateNoWindow = true;
myProc.StartInfo.Arguments = "\"" + printerName + "\"";


bool result = myProc.Start();


if (myProc.WaitForInputIdle())
{
    if (!myProc.HasExited)
    {
        myProc.WaitForExit(Convert.ToInt32(5000));
        myProc.Kill();
    }
}
myProc.Close();

Any help is much appreciated!

Thanks,
Teja.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T03:30:36+00:00Added an answer on May 21, 2026 at 3:30 am

    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.

    I ended up dropping Adobe completely by running the PDF through GhostScript. Following is the helper class I created to do the job. gsExePath should be something like C:\Program Files\gs\gs8.71\bin\gswin32c.exe.

    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)
            });
        }
    }
    

    The following should print to the Windows default printer:

    var printerName = new System.Drawing.Printing.PrinterSettings().PrinterName;
    var gs = new GSInterface(gsExePath);
    gs.Print(filename, printername);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some weird reasons I can't get this to work properly (for a 3
For some reasons I can't use xml layout files. But I need to create
Given the below setup and code snippets, what reasons can you come up with
For some reasons I can't debug my C# program in Visual Studio! -> run
Any reasons why this can not be standard behavior of free() ? multiple pointers
For reasons that only the developers can understand, Firefox will create and open .url
Are these for cross browser reasons? Hoping someone can explain them to me: opacity:.50;
Using C# 3.0, we can initialize objects without their constructors for syntactical reasons. Such
My git repo contains sensitive passwords which, for reasons out of my control, can't
I understand that calling Thread.Abort() is BAD AND WRONG because of various reasons Can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.