質問

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.

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top