Printing on client side with C # MVC automatically

0

I need to automatically print a PDF file that is in a folder on the server, but the print has to be on a specific printer on the CLIENT side.

if (!String.IsNullOrEmpty(caminho))
{
   string impressoraPadraoOriginal = new 
   System.Drawing.Printing.PrinterSettings().PrinterName;
    try
    {
     myPrinters.SetDefaultPrinter("Nome da impressora");

        Process process = new Process
        {
            StartInfo = new ProcessStartInfo
             {
                 CreateNoWindow = true,
                 Verb = "print",
                 FileName = caminho,
             },
        };
        process.Start();
    }
    catch (Exception)
    {
        throw;
    }
    finally
    {
        //Aguarda 5 segundos para alter a impresora padrão;
        System.Threading.Thread.Sleep(TimeSpan.FromSeconds(5));
        myPrinters.SetDefaultPrinter(impressoraPadraoOriginal);
    }
}

Location works correctly, but when going to the server does not work.

    
asked by anonymous 13.11.2018 / 17:38

0 answers