Quantcast
Channel: SCN : Unanswered Discussions - SAP Crystal Reports, version for Visual Studio
Viewing all articles
Browse latest Browse all 2556

PrintToPrinter fails on certain printers?

$
0
0

System info:

CrystalReport .Net Runtime 13.0.14.1720

Windows 7 Enterprise

 

The following c# code is used to print reports.

 

  rpt.Load( full path to the rpt file );

  PageMargins margins;

  

  margins = rpt.PrintOptions.PageMargins;

  margins.bottomMargin = 350;

  margins.leftMargin = 350;

  margins.rightMargin = 350;

  margins.topMargin = 350;

  rpt.PrintOptions.ApplyPageMargins(margins);

  

  rpt.PrintOptions.PrinterName = @"\\PC name\printer name";

  

  rpt.PrintToPrinter(1, false,0,0);

 

 

I have an HP LaserJet 1022 usb printer connected to my development computer.  This piece of code prints reports just fine in this situation.


Then there is another development machine in the same domain as the one above with the exact same piece of code.  The printer is added as a network printer, and I can print test pages via printer properties.  However, printing reports to this network printer failed, with "RPC server unavailable" being thrown by the PrintToPrinter call.  The remote procedure call service is running since test pages can be printed.


I have tried replacing the pc name by its IP address, but to no avail.


In both PCs the latest printer driver is used, and there are printers on the same domain that print just fine.


Any help would be appreciated.


Viewing all articles
Browse latest Browse all 2556

Trending Articles