Title: Set a print job name in C#
By default, when you send a PrintDocument to a printer, the printer spool shows the job's name as "document." You can change the print job name by setting the PrintDocument object's DocumentName property.
This example uses the following code to print a small sample document.
// Print the document.
private void btnPrint_Click(object sender, EventArgs e)
// Select the printer.
pdocFile.PrinterSettings.PrinterName = cboPrinter.Text;
// Set the print document name.
pdocFile.DocumentName = txtDocumentName.Text;
The code sets the PrintDocument object's PrinterSettings.PrinterName property so output goes to the printer you selected from the ComboBox at the top of the form.
It then sets the DocumentName property to the value you entered in the TextBox.
Finally the code calls the PrintDocument object's Print method to start printing.
If you click the Print button and then check the selected printer's spool (before the document has finished printing), you should see the print job name that you entered.
Download the example to experiment with it and to see additional details.