Question

Presently, I am attempting to print a data plot created using C#/.NET and GDI+ that has millions of data points. When the document goes to the printer, the printer says it successfully printed the document and that it printed 0 pages. The document never does get printed. Here is some of my code:

    private void btnPrint_Click(object sender, EventArgs e)
    {
        if (_config == null)
        {
            lblStatus.Text = "Error, config is null";
            return;
        }
        _pd = new PrintDocument();
        //PaperSize paperSize = new PaperSize("CustomTest", 1000, 100);
        //_pd.DefaultPageSettings.PaperSize = paperSize;
        _pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
        // Add event handler
        _pd.PrintPage += new PrintPageEventHandler(PrintPage);
        _pd.BeginPrint += new PrintEventHandler(BeginPrinting);
        // Construct print dialog
        PrintDialog pDialog = new PrintDialog();
        pDialog.AllowSomePages = true;
        pDialog.ShowHelp = true;
        pDialog.Document = _pd;
        // Ask the user for input
        DialogResult result = pDialog.ShowDialog();
        // Print if user desires
        if (result == DialogResult.OK)
        {
            _pd.Print();
        }
    }

Does anyone have any suggestions? TIA.

Was it helpful?

Solution

It turned out the corporate print spooler was getting in the way. The solution was to bypass the corporate print system and print directly to the printer, by adding the printer by IP address. It was the PCL6 driver that didn't work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top