Error trying to print document: RPC server is unavailable

0

I made 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, but it did not work.

What else can I try to resolve this?

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

Here is the snippet of code that generates the impression:

    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);
    }
    
asked by anonymous 09.03.2016 / 12:56

0 answers