How to print a document without saving it in advance. In C #?

0

I currently use the following function to print:

 private void SendToPrinter(string filePath)
    {
        ProcessStartInfo info = new ProcessStartInfo();
        info.Verb = "print";
        info.FileName = filePath;
        info.CreateNoWindow = true;
        info.WindowStyle = ProcessWindowStyle.Hidden;
        using (Process p = new Process())
        {
            p.StartInfo = info;
            p.Start();
            p.WaitForInputIdle();
            System.Threading.Thread.Sleep(3000);
            p.WaitForExit();
        }
    }

But when I call the function, I generate a file in binary, and I have no choice but to save it in a folder and then send the file to the print function.

What I want is to skip the step of saving the file on the disk. That is, when I get the binary, send it directly to the function and print.

 SendToPrinter(byte[] filePath)....

I would like to do it, of course, thank you

    
asked by Danilo 25.08.2017 в 18:20
source

0 answers