Download Parallel Crystal Developers Manual

Transcript
"PCRE API error: no print destination specified"
This message indicates that the Print Engine DLL could not figure out what to do with
your report. You must respond by sending the report to a printer or to a disk file. We'll
explore the most common solutions in the next two sections.
Overall, the simple client illustrates the importance of exception handling in Parallel
Crystal client programming. In general, you should always ensure that calls to methods in
the C++ Client Library are enclosed within an appropriate try-catch block. We'll describe
the error handling facilities in the Client Library in more detail in the next chapter.
Generating a Simple PDF Report
Adobe's Portable Document Format (PDF) is widely used as an alternative to PostScript
or HTML on the Internet. It provides PostScript quality reproduction (which is far
superior to HTML), using a more compact document encoding format.
Example 8.2 illustrates a simple C++ client that outputs a version of the Boxoffice report
to PDF. It is in fact identical to Example 8.1 with the exception of the single line
highlighted.
#include <icstrenm.h>
#include <pcre.h>
// 1.
void main( int argc, char *argv[] )
{
PCREAppClient client("example.host.com");
// 2.
try {
client.Connect();
PCREEngine *engine = client.OpenEngine();
PCREJob *job =
Engine->OpenJob("C:\\MobileApps\\PCRE\\
SampleReports\\Box.rpt");
// 3.
// 4.
// 5.
job->OutputToPDF("C:\\MobileApps\\PCRE\\
SampleOutputs\\Box.pdf", NULL);
job->Start();
job->Close();
// 6.
// 7.
// 8.
cout << "PDF report generated" << endl;
// 9.
engine->Close();
} catch ( PCREError& error ) {
error.Report();
}
// 10.
// 11.
// 12.
}
Example 8.2
Parallel Crystal Developer's Manual
Version 2.4 - Revised 5/27/00
238