|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-03-26 09:03 UTC] andy at advancethermal dot com
Specifying a printer from the SelectPrinter method causes PHP to crash.
The following code:
-----
$crapp = new COM("CrystalDesignRunTime.Application");
$creport = $crapp->OpenReport("d:\\athermal\\reports\\backlog.rpt", 1);
$creport->SelectPrinter("winspool", "HP LaserJet 1200 Series PCL", "Ne01:");
print "DEBUG|".$creport->DriverName."|".$creport->PrinterName."|".$creport->PortName."|";
$creport->PrintOut(False);
-----
Produces the following output:
-----
Content-type: text/html
X-Powered-By: PHP/4.3.1
winspool|HP LaserJet 1200 Series PCL|Ne01:|<br />
<b>Warning</b>: (null)(): Invoke() failed: Exception occurred.
<b>Source</b>: Crystal Reports ActiveX Designer <b>Description</b>: Error start
ing print job. Please check your printer or network connection. in <b>d:\atherma
l\temp\test.php</b> on line <b>7</b><br />
-----
Other items to note:
- When the SelectPrinter line is commented out, the report prints fine to the default printer and the DEBUG line prints "DEBUG|||".
- If the PrintOut line is commented out, the DEBUG line prints "DEBUG|winspool|HP LaserJet 1200 Series PCL|Ne01:|" without any error.
- If the PortName is not specified, or specified incorrectly on the SelectPrinter line, it is printed correctly on the DEBUG line. (i.e. if "Ne00:" is specified on the SelectPrinter line, "Ne01:" is reported on the DEBUG line.)
aap
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 22:00:01 2025 UTC |
Crystal Decisions provided a resolution to the problem. The PaperOrientation method must be specified if the SelectPrinter method is used. Here is the code that works. $crapp = new COM("CrystalDesignRunTime.Application"); $creport = $crapp->OpenReport("d:\\athermal\\reports\\backlog.rpt", 1); $creport->SelectPrinter("winspool", "HP LaserJet 1200 Series PCL", "Ne01:"); $creport->PaperOrientation = 0; $creport->PrintOut(False);