Error trying to print document: The RPC server is not available

Asked

Viewed 431 times

0

I made a software where one of the pages can be printed. On some computers it works normally and prints the page in PDF without problems. In others, when trying to print, the error appears: "The RPC server is not available."

I tried to restart the RPC service on the machine where the error occurred, ms did not work.

What else can I try to solve this?

Note: My program already has System.Drawing.Printing;

Follows the excerpt of the code that generates the print:

    private void imprimirToolStripMenuItem_Click(object sender, EventArgs e)
    {
        // Create new PrintDocument 
        System.Drawing.Printing.PrintDocument pd = new System.Drawing.Printing.PrintDocument();
        // Add a PrintPageEventHandler for the document 
        pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
        // Print the document 
        pd.DefaultPageSettings.Landscape = true;
        pd.Print();

    }

    private void pd_PrintPage(object sender, PrintPageEventArgs ev)
    {
        // Create and initialize print font 
        System.Drawing.Font printFont = new System.Drawing.Font("Arial", 10);
        // Create Rectangle structure, used to set the position of the chart Rectangle 
        Rectangle myRec = new System.Drawing.Rectangle(10, 30, 1120, 750);
        // Draw a line of text, followed by the chart, and then another line of text 
        //ev.Graphics.DrawString("Relatório", printFont, Brushes.Black, 500, 500);
        chartMain.Printing.PrintPaint(ev.Graphics, myRec);
        //ev.Graphics.DrawString("Line after chart", printFont, Brushes.Black, 500, 500);
    }
  • When it fails, the test is done on a remote printer?

  • 1

    Hello rray! Yes, it is a remote printer. I discovered that this was happening because this remote printer is not mapped on my network. Thank you very much!!!

  • Creates an answer :) to help others with this problem

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.