0

I've got an aps.net site. Can I start a print request for a pdf from a client to a printer connected only to the server? In my server I use this code in a web api

    [HttpPost]
    public void Print()
    {
        ProcessStartInfo info = new ProcessStartInfo();
        info.Verb = "print";
        info.FileName = @"C:\Users\Me\Documents\Doc.pdf";
        info.CreateNoWindow = true;
        info.WindowStyle = ProcessWindowStyle.Hidden;

        Process p = new Process();
        p.StartInfo = info;
        p.Start();
    }

If I run this request while debugging it works (i mean it prints the doc correctly), but if I start the request with with postman from a virtual machine (to simulate a network request) and debug the process attached to a IIS site no error will rise but no print done. The debug steps correctly all the instructions.

I set my application pool with my user identity (admin) and "connect as" on the site as well as my user.

I don't know if It can't be done cause on ASP.NET or cause I'm missing something.

Akrax
  • 53
  • 5
  • What is the exit code/errors? check here to see how to get it: https://social.msdn.microsoft.com/Forums/vstudio/en-US/ab3c0cc7-83c2-4a86-9188-40588b7d1a52/processstart-of-xcopy-only-works-under-the-debugger?forum=netfxbcl – Luis May 17 '15 at 16:27
  • possible duplicate of [Printing a PDF Silently with Adobe Acrobat](http://stackoverflow.com/questions/4868982/printing-a-pdf-silently-with-adobe-acrobat) – tgolisch May 18 '15 at 18:16

1 Answers1

0

This will do. I print with foxit reader. Maybe my default, Acrobat, have some isseus or asking for user interaction.

Community
  • 1
  • 1
Akrax
  • 53
  • 5