Buscar contenidos

lunes, 11 de diciembre de 2017

C# Imprimir PDF a una impresora en específico




string a = System.Environment.MachineName;

Process proc = new Process();
//"C:\\Program Files (x86)\\Adobe\\Acrobat Reader DC\\Reader\\AcroRd32.exe"
proc.StartInfo.FileName = adobePath;

//FilePath: c://test.pdf
proc.StartInfo.Arguments = @" /t /h " + "\"" + FilePath + "\"" + " " + "\"" + "Bullzip PDF Printer" + "\"";
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
Thread.Sleep(1000);
proc.WaitForInputIdle();




public static List<string> GetPrinterList()
{
    List<string> l = new List<string>();

    foreach (string printer in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
    {
        l.Add(printer);
    }

    return l;
}

public static string GetDefaultPrinter()
{
    PrinterSettings settings = new PrinterSettings();

    return (settings.PrinterName);
}
 

No hay comentarios:

Publicar un comentario