[Rendering Formats- Silent Printing]

In order to do silent printing (of a glint file), a few things are required.

  1. add correct jar files into the project
  2. codes to generate the rml file into a Glint, load the glint file then print using the printer specified
  3. a batch file to run the job
  4. correct syntax for running the batch file

(1) There are two jar files which are necessary in order for the project to run successfully. They are Glint.jar (for printing) and RepertoireClient.jar. These two files can be found under the server directory. (\clients\lib)

(2) There a few steps to execute before being able to proceed to silent printing. Firstly, generate the report template (.rml) in a desired output format. In this case, the output format will be glint file. Next, load the glint file. Finally, print the glint file from the printer specified.

2.1 Generating a report
The following illustrates the connection to the server and report generation :

ERSClient ersClient = new ERSClient(“localhost”, 8080, “user”, “pass”);

FileOutputStream fos = new FileOutputStream(new File(args[1]));
ersClient.renderReport(args[0], “application/x-glint”, fos, new Properties());
fos.close();

Information regarding report generation can also be found in page 21 of Elixir Repertoire Server.pdf.

2.2 Load a glint and print using the specified printer
The following is to the load the glint file and print it at the specified printer.

import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import com.elixirtech.ers2.client.ERSClient;
import com.elixirtech.glint.print.GlintStreamPrinter;

FileInputStream fis = new FileInputStream(filename);
GlintStreamPrinter gsp = new GlintStreamPrinter();

if (printer == null)
gsp.setTargetPrinters(new String[] {printer});
PrintRequestAttributeSet set = new HashPrintRequestAttributeSet();

//set the resolution of the print job
//is optional (will affect file size and may affect image quality)
//PrinterResolution pr = new PrinterResolution(100,100, PrinterResolution.DPI);
//set.add(pr);

gsp.print(false, fis, set, new JobListener());
fis.close();

(3) The text below are to be in the batch file :

java -classpath “\lib\RepertoireClient.jar;\lib\Glint.jar;\classes” com.elixirtech.demo.CmdGlintPrint %1 %2 %3

(4) Lastly, when executing the batch file, kindly include the path of the report template, the output of the Glint file and the printer name (the sequence of entering needs to be in the correct order). For example, in the Command Prompt, enter the following :

print-report.bat “/ElixirSamples/Report/Components/Checkbox.rml” “C:\Program Files\Elixir Repertoire\RepertoireServer\clients\bin\out\report.glint” “myPrinter”