2
Answers

Print in two printers at the same time

I wanna make a copy of the document that I sent to print, but I don't know the full path of the document,

Is there a way to print the same document in to printers at the same time

I wanna print at the same time in Microsoft Print to PDF, to make a copy of the PrintSystemInfoJob that is printing

 

I'm using C#

Answers (2)
4
Abhishek  Yadav

Abhishek Yadav

108 17.2k 347k Aug 01

Yes, you can print the same document to two printers simultaneously using C#. To achieve this, you’ll need to print the document to both printers using their respective print queues. Here’s a step-by-step guide on how you might accomplish this:

  1. Set Up the Print Document: First, create a PrintDocument object in C# that represents the document you want to print.

  2. Define the Print Jobs: Create two separate PrintDocument objects or configure the same PrintDocument object to use different PrintQueue objects.

  3. Print to Multiple Printers: Print the document to both printers by invoking the Print method on each PrintDocument object.

Here's a sample code snippet to illustrate how you might implement this:

using System;
using System.Drawing.Printing;
using System.Windows.Forms;

public class PrintHelper
{
    public void PrintToMultiplePrinters(string printerName1, string printerName2)
    {
        // Create the PrintDocument object
        PrintDocument printDoc = new PrintDocument();
        
        // Set the PrintDocument's PrintPage event handler
        printDoc.PrintPage += new PrintPageEventHandler(PrintPageHandler);

        // Set up the printers
        PrinterSettings printerSettings1 = new PrinterSettings { PrinterName = printerName1 };
        PrinterSettings printerSettings2 = new PrinterSettings { PrinterName = printerName2 };

        // Print to the first printer
        printDoc.PrinterSettings = printerSettings1;
        printDoc.Print();

        // Print to the second printer
        printDoc.PrinterSettings = printerSettings2;
        printDoc.Print();
    }

    private void PrintPageHandler(object sender, PrintPageEventArgs e)
    {
        // Here you would add code to draw the content you want to print
        e.Graphics.DrawString("Hello, world!", new Font("Arial", 12), Brushes.Black, new PointF(100, 100));
    }
}
Accepted
1
Jorge Carlos Iglesias Alvarez

Jorge Carlos Iglesias Alvarez

1.4k 265 3.4k Aug 01

Thank You so much for your answer 

I'm getting the Print Job properties witch Win32_PrintJob

Then I use the ID value in the class SystemPrintInfoJob to ask for JobStream , but the value is always null

I wanna use that value to but later use send to Print 

You know why that happens 

Why that value is always null ??

 

Thank you