The simplest sample for connecting to Parallel Crystal and generating a report
Download PDF version of this faq: SimpleConnection_CodeSample.pdf
NOTE: PCRE v2.7/3.7 users must change the package name from
com.mobileapps.pcre to com.dynalivery.pcre
import com.mobileapps.pcre.*;
class MASSimpleApp {
public static void main(String [] args)
{
PCREApplicationClient client = null;
try
{
client = new PCREApplicationClient("SERVER NAME");
client.Connect();
PCREEngine engine = client.OpenEngine();
PCREJob job = engine.OpenJob("PATH TO REPORT.rpt");
//PCREHTMLJobExportInfo info = new PCREHTMLJobExportInfo("OUTPUT PATH TO.html");
//job.ExportTo (info);
job.OutputToPDF("OUTPUT PATH TO.pdf", null);
job.Start();
job.Close();
System.out.println("Report Finished");
engine.Close();
}
catch ( PCREError ex )
{
System.out.println("Exception: "+ex);
}
finally
{
if (client !=null) client.Quit();
}
}
}
|