Fiz um software onde uma das páginas pode ser impressa. Em alguns computadores ele funciona normalmente e imprime a página em PDF sem problemas. Em outras, ao tentar imprimir, surge o erro: “O servidor RPC não está disponível.”
Tentei reiniciar o serviço do RPC na máquina onde ocorreu o erro, ms não deu certo.
O que mais posso tentar para resolver isso?
Obs.: Meu programa já tem o System.Drawing.Printing;
Segue o trecho do código que gera a impressão:
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);
}