Download Parallel Crystal Developers Manual
Transcript
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 2.2 on page 37, illustrates a simple Java client that outputs a version of the
Boxoffice report to PDF. It is in fact identical to Example 2.1 with the exception of the
single line highlighted.
import com.mobileapps.pcre.*;
// 1.
class PDFExample
{
public static void main( String [] args )
{
PCREApplicationClient client = null;
try
{
client = new PCREApplicationClient("example.host.com"); //
2.
client.Connect();
// 3.
PCREEngine engine = client.OpenEngine();
// 4.
PCREJob job = engine.OpenJob(
"C:\\MobileApps\\PCRE\\SampleReports\\Box.rpt");
// 5.
job.OutputToPDF(
"C:\\MobileApps\\PCRE\\SampleOutputs\\Box.pdf",
null);
job.Start();
job.Close();
// 6.
// 7.
// 8.
System.out.println("Report generated");
engine.Close();
// 9.
// 10.
}
catch ( PCREError ex )
{
System.out.println(“Exception: “+ex);
}
finally
{
if (client != null) client.Quit();
}
// 11.
// 12.
// 13.
}
}
Example 2.2
Parallel Crystal Developer's Manual
Version 2.4 - Revised 5/27/00
37