0
votes

I have to send a PDF file ( CAD drawing ) to a specific printer in the network. I also have to set the papersize for the document.

Has anyone an idea how to code this in C# without using any 3rd party library ?

Tried this => https://support.microsoft.com/en-us/help/322091/how-to-send-raw-data-to-a-printer-by-using-visual-c--net
But this is not working ( only printing some cryptical signs ).

1

1 Answers

0
votes

If you don't want to use a 3rd party, you can use this pure C# code which created a Process with arguments to print any file:

using System.Diagnostics;

Process proc = new Process();
proc.StartInfo = new ProcessStartInfo()
{
    CreateNoWindow = true,
    Verb = "print",
    // Path to your PDF
    FileName = pathToPDF
};
proc.Start();