KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > compiere > print > ReportEngine


1 /******************************************************************************
2  * The contents of this file are subject to the Compiere License Version 1.1
3  * ("License"); You may not use this file except in compliance with the License
4  * You may obtain a copy of the License at http://www.compiere.org/license.html
5  * Software distributed under the License is distributed on an "AS IS" basis,
6  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
7  * the specific language governing rights and limitations under the License.
8  * The Original Code is Compiere ERP & CRM Business Solution
9  * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
10  * Portions created by Jorg Janke are Copyright (C) 1999-2002 Jorg Janke, parts
11  * created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
12  * Contributor(s): ______________________________________.
13  *****************************************************************************/

14 package org.compiere.print;
15
16 import java.io.*;
17 import java.util.*;
18 import java.sql.*;
19 import javax.xml.transform.stream.*;
20
21 import java.awt.print.*;
22 import javax.print.*;
23 import javax.print.attribute.*;
24 import javax.print.attribute.standard.*;
25 import javax.print.event.*;
26
27 import org.apache.ecs.*;
28 import org.apache.ecs.xhtml.*;
29 import org.apache.log4j.Logger;
30
31 import org.compiere.util.*;
32 import org.compiere.model.*;
33 import org.compiere.print.layout.*;
34
35 // You can get a demo version via http://www.qoppa.com/demo/jPDFPrinter.jar
36
// The full version is included in the ComPiere Support, and you can get it also from http://www.qoppa.com
37
import com.qoppa.pdfPrinter.PDFPrinterJob;
38
39 /**
40  * Report Engine.
41  * For a given PrintFormat,
42  * create a Report
43  *
44  * @author Jorg Janke
45  * @version $Id: ReportEngine.java,v 1.36 2003/08/18 15:54:21 jjanke Exp $
46  */

47 public class ReportEngine implements PrintServiceAttributeListener
48 {
49     /**
50      * Constructor
51      * @param ctx context
52      * @param pf Print Format
53      * @param query Optional Query
54      */

55     public ReportEngine (Properties ctx, MPrintFormat pf, MQuery query)
56     {
57         if (pf == null)
58             throw new IllegalArgumentException JavaDoc("ReportEngine - no PrintFormat");
59         log.debug(pf + " - " + query);
60         m_ctx = ctx;
61         m_printFormat = pf;
62         setQuery(query); // loads Data
63
} // ReportEngine
64

65     /** Logger */
66     private Logger log = Logger.getLogger (getClass());
67
68     /** Context */
69     private Properties m_ctx;
70
71     /** Print Format */
72     private MPrintFormat m_printFormat;
73     /** Query */
74     private MQuery m_query;
75     /** Query Data */
76     private PrintData m_printData;
77     /** Layout */
78     private LayoutEngine m_layout = null;
79     /** Printer */
80     private String JavaDoc m_printerName = Ini.getProperty(Ini.P_PRINTER);
81     /** View */
82     private View m_view = null;
83
84
85     /**
86      * Set PrintFormat.
87      * If Layout was created, re-create layout
88      * @param pf print format
89      */

90     protected void setPrintFormat (MPrintFormat pf)
91     {
92         m_printFormat = pf;
93         if (m_layout != null)
94         {
95             setPrintData();
96             m_layout.setPrintFormat(pf, false);
97             m_layout.setPrintData(m_printData, m_query, true); // format changes data
98
}
99         if (m_view != null)
100             m_view.revalidate();
101     } // setPrintFormat
102

103     /**
104      * Set Query and generate PrintData.
105      * If Layout was created, re-create layout
106      * @param query query
107      */

108     protected void setQuery (MQuery query)
109     {
110         m_query = query;
111         if (query == null)
112             return;
113         //
114
setPrintData();
115         if (m_layout != null)
116             m_layout.setPrintData(m_printData, m_query, true);
117         if (m_view != null)
118             m_view.revalidate();
119     } // setQuery
120

121     /**
122      * Get Query
123      * @return query
124      */

125     public MQuery getQuery()
126     {
127         return m_query;
128     } // getQuery
129

130     /**
131      * Set PrintData for Format restricted by Query.
132      * Nothing set if there is no query
133      * Sets m_printData
134      */

135     private void setPrintData()
136     {
137         if (m_query == null)
138             return;
139         DataEngine de = new DataEngine(m_printFormat.getLanguage());
140         setPrintData(de.getPrintData (m_ctx, m_printFormat, m_query));
141     // m_printData.dump();
142
} // setPrintData
143

144     /**
145      * Set PrintData
146      * @param printData printData
147      */

148     public void setPrintData (PrintData printData)
149     {
150         if (printData == null)
151             return;
152         m_printData = printData;
153     } // setPrintData
154

155     /*************************************************************************/
156
157     /**
158      * Layout
159      */

160     private void layout()
161     {
162         if (m_printFormat == null)
163             throw new IllegalStateException JavaDoc ("ReportEngine.layout - no print format");
164         if (m_printData == null)
165             throw new IllegalStateException JavaDoc ("ReportEngine.layout - no print data");
166         m_layout = new LayoutEngine (m_printFormat, m_printData, m_query);
167     } // layout
168

169     /**
170      * Get Layout
171      * @return Layout
172      */

173     protected LayoutEngine getLayout()
174     {
175         if (m_layout == null)
176             layout();
177         return m_layout;
178     } // getLayout
179

180     /**
181      * Get PrintFormat (Report) Name
182      * @return name
183      */

184     public String JavaDoc getName()
185     {
186         return m_printFormat.getName();
187     } // getName
188

189     /**
190      * Get PrintFormat
191      * @return print format
192      */

193     public MPrintFormat getPrintFormat()
194     {
195         return m_printFormat;
196     } // getPrintFormat
197

198     /**
199      * Get PrintLayout (Report) Context
200      * @return context
201      */

202     public Properties getCtx()
203     {
204         return m_layout.getCtx();
205     } // getCtx
206

207     /**
208      * Get Row Count
209      * @return row count
210      */

211     public int getRowCount()
212     {
213         return m_printData.getRowCount();
214     } // getRowCount
215

216     /**
217      * Get Column Count
218      * @return column count
219      */

220     public int getColumnCount()
221     {
222         if (m_layout != null)
223             return m_layout.getColumnCount();
224         return 0;
225     } // getColumnCount
226

227     /*************************************************************************/
228
229     /**
230      * Get View Panel
231      * @return view panel
232      */

233     public View getView()
234     {
235         if (m_layout == null)
236             layout();
237         if (m_view == null)
238             m_view = new View (m_layout);
239         return m_view;
240     } // getView
241

242     /*************************************************************************/
243
244     /**
245      * Print Report
246      * @param withDialog show PrintDialog
247      * @param isDocument if true enables copy indicator
248      * @param copies copies
249      * @param printerName optional printer name
250      */

251     public void print (boolean withDialog, int copies, boolean isDocument, String JavaDoc printerName)
252     {
253         log.info("print - Copies=" + copies + ", Document=" + isDocument + ", Printer=" + printerName);
254         if (m_layout == null)
255             layout();
256         Print print = new Print (m_layout, false);
257         // Paper Attributes: media-printable-area, orientation-requested, media
258
PrintRequestAttributeSet prats = m_layout.getPaper().getPrintRequestAttributeSet();
259         // add: copies, job-name, priority
260
if (isDocument || copies < 1)
261             prats.add (new Copies(1));
262         else
263             prats.add (new Copies(copies));
264         Locale locale = Language.getLanguage().getLocale();
265         prats.add(new JobName(m_printFormat.getName(), locale));
266         prats.add(PrintUtil.getJobPriority(m_layout.getPageCount(), copies, true));
267
268         // PrinterJob
269
PrinterJob job = getPrinterJob(printerName);
270     // job.getPrintService().addPrintServiceAttributeListener(this);
271
job.setPageable(print);
272         // Dialog
273
if (withDialog && !job.printDialog(prats))
274             return;
275
276         // submit
277
boolean printCopy = isDocument && copies > 1;
278         PrintUtil.print(job, prats, false, printCopy);
279
280         // Document: Print Copies
281
if (printCopy)
282         {
283             log.info("print - Copy " + (copies-1));
284             print = new Print (m_layout, true); // isCopy
285
prats.add(new Copies(copies-1));
286             job = getPrinterJob(printerName);
287         // job.getPrintService().addPrintServiceAttributeListener(this);
288
job.setPageable (print);
289             PrintUtil.print(job, prats, false, false);
290         }
291     } // print
292

293     /**
294      * Print Service Attribute Listener.
295      * @param psae event
296      */

297     public void attributeUpdate(PrintServiceAttributeEvent psae)
298     {
299         /**
300 PrintEvent on Win32 Printer : \\MAIN\HP LaserJet 5L
301 PrintServiceAttributeSet - length=2
302 queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
303 printer-is-accepting-jobs = accepting-jobs (class javax.print.attribute.standard.PrinterIsAcceptingJobs)
304 PrintEvent on Win32 Printer : \\MAIN\HP LaserJet 5L
305 PrintServiceAttributeSet - length=1
306 queued-job-count = 1 (class javax.print.attribute.standard.QueuedJobCount)
307 PrintEvent on Win32 Printer : \\MAIN\HP LaserJet 5L
308 PrintServiceAttributeSet - length=1
309 queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
310         **/

311         System.out.println(psae);
312         PrintUtil.dump (psae.getAttributes());
313     } // attributeUpdate
314

315
316     /**
317      * Get PrinterJob based on PrinterName
318      * @param printerName optional Printer Name
319      * @return PrinterJob
320      */

321     private PrinterJob getPrinterJob (String JavaDoc printerName)
322     {
323         if (printerName != null && printerName.length() > 0)
324             return CPrinter.getPrinterJob(printerName);
325         return CPrinter.getPrinterJob(m_printerName);
326     } // getPrinterJob
327

328     /**
329      * Show Dialog and Set Paper
330      * Optionally re-calculate layout
331      */

332     public void pageSetupDialog ()
333     {
334         if (m_layout == null)
335             layout();
336         m_layout.pageSetupDialog(getPrinterJob(m_printerName));
337         if (m_view != null)
338             m_view.revalidate();
339     } // pageSetupDialog
340

341     /**
342      * Set Printer (name)
343      * @param printerName valid printer name
344      */

345     public void setPrinterName(String JavaDoc printerName)
346     {
347         if (printerName == null)
348             m_printerName = Ini.getProperty(Ini.P_PRINTER);
349         else
350             m_printerName = printerName;
351     } // setPrinterName
352

353     /**
354      * Get Printer (name)
355      * @return printer name
356      */

357     public String JavaDoc getPrinterName()
358     {
359         return m_printerName;
360     } // getPrinterName
361

362     /*************************************************************************/
363
364     /**
365      * Create HTML File
366      * @param file file
367      * @param onlyTable if false create complete HTML document
368      * @param language optional language - if null teh default language is used to format nubers/dates
369      * @return true if success
370      */

371     public boolean createHTML (File file, boolean onlyTable, Language language)
372     {
373         try
374         {
375             Language lang = language;
376             if (lang == null)
377                 lang = Language.getLanguage();
378             FileWriter fw = new FileWriter (file, false);
379             return createHTML (new BufferedWriter(fw), onlyTable, lang);
380         }
381         catch (FileNotFoundException fnfe)
382         {
383             log.error("createHTML(f) - " + fnfe.toString());
384         }
385         catch (Exception JavaDoc e)
386         {
387             log.error("createHTML(f)", e);
388         }
389         return false;
390     } // createHTML
391

392     /**
393      * Write HTML to writer
394      * @param writer writer
395      * @param onlyTable if false create complete HTML document
396      * @param language optional language - if null nubers/dates are not formatted
397      * @return true if success
398      */

399     public boolean createHTML (Writer writer, boolean onlyTable, Language language)
400     {
401         try
402         {
403             table table = new table();
404             //
405
// for all rows (-1 = header row)
406
for (int row = -1; row < m_printData.getRowCount(); row++)
407             {
408                 tr tr = new tr();
409                 table.addElement(tr);
410                 if (row != -1)
411                     m_printData.setRowIndex(row);
412                 // for all columns
413
for (int col = 0; col < m_printFormat.getItemCount(); col++)
414                 {
415                     MPrintFormatItem item = m_printFormat.getItem(col);
416                     if (item.isPrinted())
417                     {
418                         // header row
419
if (row == -1)
420                         {
421                             th th = new th();
422                             tr.addElement(th);
423                             th.addElement(Util.maskHTML(item.getPrintName(language)));
424                         }
425                         else
426                         {
427                             td td = new td();
428                             tr.addElement(td);
429                             Object JavaDoc obj = m_printData.getNode(new Integer JavaDoc(item.getAD_Column_ID()));
430                             if (obj == null)
431                                 td.addElement("&nbsp;");
432                             else if (obj instanceof PrintDataElement)
433                             {
434                                 String JavaDoc value = ((PrintDataElement)obj).getValueDisplay(language); // formatted
435
td.addElement(Util.maskHTML(value));
436                             }
437                             else if (obj instanceof PrintData)
438                             {
439                                 // ignore contained Data
440
}
441                             else
442                                 log.error("createHTML - Element not PrintData(Element) " + obj.getClass());
443                         }
444                     } // printed
445
} // for all columns
446
} // for all rows
447

448             //
449
PrintWriter w = new PrintWriter(writer);
450             if (onlyTable)
451                 table.output(w);
452             else
453             {
454                 XhtmlDocument doc = new XhtmlDocument();
455                 doc.appendBody(table);
456                 doc.output(w);
457             }
458             w.flush();
459             w.close();
460         }
461         catch (Exception JavaDoc e)
462         {
463             log.error("createHTML(w)", e);
464         }
465         return false;
466     } // createHTML
467

468
469     /*************************************************************************/
470
471     /**
472      * Create CSV File
473      * @param file file
474      * @param delimiter delimiter, e.g. comma, tab
475      * @param language translation language
476      * @return true if success
477      */

478     public boolean createCSV (File file, char delimiter, Language language)
479     {
480         try
481         {
482             FileWriter fw = new FileWriter (file, false);
483             return createCSV (new BufferedWriter(fw), delimiter, language);
484         }
485         catch (FileNotFoundException fnfe)
486         {
487             log.error("createCSV(f) - " + fnfe.toString());
488         }
489         catch (Exception JavaDoc e)
490         {
491             log.error("createCSV(f)", e);
492         }
493         return false;
494     } // createCSV
495

496     /**
497      * Write CSV to writer
498      * @param writer writer
499      * @param delimiter delimiter, e.g. comma, tab
500      * @param language translation language
501      * @return true if success
502      */

503     public boolean createCSV (Writer writer, char delimiter, Language language)
504     {
505         if (delimiter == 0)
506             delimiter = '\t';
507         try
508         {
509             // for all rows (-1 = header row)
510
for (int row = -1; row < m_printData.getRowCount(); row++)
511             {
512                 StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
513                 if (row != -1)
514                     m_printData.setRowIndex(row);
515
516                 // for all columns
517
boolean first = true; // first column to print
518
for (int col = 0; col < m_printFormat.getItemCount(); col++)
519                 {
520                     MPrintFormatItem item = m_printFormat.getItem(col);
521                     if (item.isPrinted())
522                     {
523                         // column delimiter (comma or tab)
524
if (first)
525                             first = false;
526                         else
527                             sb.append(delimiter);
528                         // header row
529
if (row == -1)
530                             createCSVvalue (sb, delimiter,
531                                 m_printFormat.getItem(col).getPrintName(language));
532                         else
533                         {
534                             Object JavaDoc obj = m_printData.getNode(new Integer JavaDoc(item.getAD_Column_ID()));
535                             String JavaDoc data = "";
536                             if (obj == null)
537                                 ;
538                             else if (obj instanceof PrintDataElement)
539                             {
540                                 data = ((PrintDataElement)obj).getValueDisplay(null); // not formatted
541
}
542                             else if (obj instanceof PrintData)
543                             {
544                             }
545                             else
546                                 log.error("createCSV - Element not PrintData(Element) " + obj.getClass());
547                             createCSVvalue (sb, delimiter, data);
548                         }
549                     } // printed
550
} // for all columns
551
writer.write(sb.toString());
552                 writer.write(Env.NL);
553             } // for all rows
554
//
555
writer.flush();
556             writer.close();
557         }
558         catch (Exception JavaDoc e)
559         {
560             log.error("createCSV(w)", e);
561         }
562         return false;
563     } // createCSV
564

565     /**
566      * Add Content to CSV string.
567      * Encapsulate/mask content in " if required
568      * @param sb StringBuffer to add to
569      * @param delimiter delimiter
570      * @param content column value
571      */

572     private void createCSVvalue (StringBuffer JavaDoc sb, char delimiter, String JavaDoc content)
573     {
574         // nothing to add
575
if (content == null || content.length() == 0)
576             return;
577         //
578
boolean needMask = false;
579         StringBuffer JavaDoc buff = new StringBuffer JavaDoc();
580         char chars[] = content.toCharArray();
581         for (int i = 0; i < chars.length; i++)
582         {
583             char c = chars[i];
584             if (c == '"')
585             {
586                 needMask = true;
587                 buff.append(c); // repeat twice
588
} // mask if any control character
589
else if (!needMask && (c == delimiter || !Character.isLetterOrDigit(c)))
590                 needMask = true;
591             buff.append(c);
592         }
593
594         // Optionally mask value
595
if (needMask)
596             sb.append('"').append(buff).append('"');
597         else
598             sb.append(buff);
599     } // addCSVColumnValue
600

601     /*************************************************************************/
602
603     /**
604      * Create XML File
605      * @param file file
606      * @return true if success
607      */

608     public boolean createXML (File file)
609     {
610         try
611         {
612             FileWriter fw = new FileWriter (file, false);
613             return createXML (new BufferedWriter(fw));
614         }
615         catch (FileNotFoundException fnfe)
616         {
617             log.error("createXML(f) - " + fnfe.toString());
618         }
619         catch (Exception JavaDoc e)
620         {
621             log.error("createXML(f)", e);
622         }
623         return false;
624     } // createXML
625

626     /**
627      * Write XML to writer
628      * @param writer writer
629      * @return true if success
630      */

631     public boolean createXML (Writer writer)
632     {
633         try
634         {
635             m_printData.createXML(new StreamResult(writer));
636             writer.flush();
637             writer.close();
638         }
639         catch (Exception JavaDoc e)
640         {
641             log.error("createXML(w)", e);
642         }
643         return false;
644     } // createXML
645

646     /*************************************************************************/
647
648     /**
649      * Create PDF file.
650      * (created in temporary storage)
651      * @return PDF file
652      */

653     public File getPDF()
654     {
655         return getPDF(null);
656     } // getPDF
657

658     /**
659      * Create PDF file.
660      * @param file file
661      * @return PDF file
662      */

663     public File getPDF (File file)
664     {
665         if (file == null)
666         {
667             try
668             {
669                 file = File.createTempFile ("ReportEngine", ".pdf");
670             }
671             catch (Exception JavaDoc ex)
672             {
673                 log.error("getFile", ex);
674             }
675         }
676         if (createPDF (file))
677             return file;
678         return null;
679     } // getPDF
680

681     /**
682      * Create PDF File
683      * @param file file
684      * @return true if success
685      */

686     public boolean createPDF (File file)
687     {
688         try
689         {
690             if (file == null)
691                 file = File.createTempFile ("ReportEngine", ".pdf");
692
693             // get format
694
if (m_layout == null)
695                 layout ();
696             Print print = new Print (m_layout, false);
697
698             // Paper Attributes: media-printable-area, orientation-requested, media
699
PrintRequestAttributeSet prats = m_layout.getPaper ().
700                                              getPrintRequestAttributeSet ();
701             prats.add (new JobName (file.getAbsolutePath (), Locale.getDefault ()));
702             // Destination
703
prats.add (new Destination (file.toURI ()));
704
705             /**
706              * You can get a demo version via
707              * http://www.qoppa.com/demo/jPDFPrinter.jar
708              * The full version is included in the ComPiere Support,
709              * and you can get it also from http://www.qoppa.com
710              */

711             if (false)
712                 Class.forName("com.qoppa.pdfPrinter.PDFPrinterJob");
713             //
714
PDFPrinterJob job = (PDFPrinterJob)PDFPrinterJob.getPrinterJob ();
715             // job.getPrintService().addPrintServiceAttributeListener(this);
716
job.setPrintable(print, m_layout.getPageFormat());
717             log.debug("createPDF - " + file.getAbsolutePath() + " - " + file.length());
718             job.print(file.getAbsolutePath());
719             log.info("createPDF - " + file.getAbsolutePath() + " - " + file.length());
720             /** End Quoppa stuff **/
721
722             /**
723              * Alternatively to getting a license, you could use this
724              *
725             // Search for PrintService (but w/o attributes)
726             PrintService[] pss =
727                 PrintServiceLookup.lookupPrintServices(DocFlavor.SERVICE_FORMATTED.PAGEABLE, new HashPrintRequestAttributeSet());
728             boolean printed = false;
729             for (int i = 0; !printed && i < pss.length; i++)
730             {
731                 PrintService ps = pss[i];
732                 String name = ps.getName();
733                 if (name.indexOf("PDF") != -1)
734                 {
735                     log.info("createPDF", name);
736                     ps.createPrintJob().print(print, prats);
737                 // PrintUtil.dump(prats);
738                     printed = true; // take first
739                 }
740             }
741             if (!printed)
742                 log.error("createPDF - NO PDF Printer");
743             /** End PrintService Stuff **/

744
745             return true;
746         }
747         catch (ClassNotFoundException JavaDoc cnf)
748         {
749             log.error("Download http://www.qoppa.com/demo/jPDFPrinter.jar and save it in the lib directory");
750         }
751         catch (Exception JavaDoc e)
752         {
753             log.error("createPDF", e);
754         }
755         // Error
756
return false;
757     } // createPDF
758

759     /*************************************************************************/
760
761     /**
762      * Create PostScript File
763      * @param file file
764      * @return true if success
765      */

766     public boolean createPS (File file)
767     {
768         try
769         {
770             return createPS (new FileOutputStream(file));
771         }
772         catch (FileNotFoundException fnfe)
773         {
774             log.error("createPS(f) - " + fnfe.toString());
775         }
776         catch (Exception JavaDoc e)
777         {
778             log.error("createPS(f)", e);
779         }
780         return false;
781     } // createPS
782

783     /**
784      * Write PostScript to writer
785      * @param fos file output stream
786      * @return true if success
787      */

788     public boolean createPS (FileOutputStream fos)
789     {
790         try
791         {
792             String JavaDoc outputMimeType = DocFlavor.BYTE_ARRAY.POSTSCRIPT.getMimeType();
793             DocFlavor docFlavor = DocFlavor.SERVICE_FORMATTED.PAGEABLE;
794             StreamPrintServiceFactory[] spsfactories =
795                 StreamPrintServiceFactory.lookupStreamPrintServiceFactories(docFlavor, outputMimeType);
796             if (spsfactories.length == 0)
797             {
798                 log.error("createPS(fos) - No StreamPrintService");
799                 return false;
800             }
801             // just use first one - sun.print.PSStreamPrinterFactory
802
// System.out.println("- " + spsfactories[0]);
803
StreamPrintService sps = spsfactories[0].getPrintService(fos);
804             // get format
805
if (m_layout == null)
806                 layout();
807             Print print = new Print (m_layout, false);
808             // print it
809
sps.createPrintJob().print(print, new HashPrintRequestAttributeSet());
810             //
811
fos.flush();
812             fos.close();
813         }
814         catch (Exception JavaDoc e)
815         {
816             log.error("createPS(fos)", e);
817         }
818         return false;
819     } // createPS
820

821
822     /*************************************************************************/
823
824     /**
825      * Test
826      * @param args args
827      */

828     public static void main(String JavaDoc[] args)
829     {
830         org.compiere.Compiere.startupClient();
831         //
832
int AD_Table_ID = 100;
833         MQuery q = new MQuery("AD_Table");
834         q.addRestriction("AD_Table_ID", "<", 108);
835         //
836
MPrintFormat f = MPrintFormat.createFromTable(Env.getCtx(), AD_Table_ID);
837         ReportEngine re = new ReportEngine(Env.getCtx(), f, q);
838         re.layout();
839         /**
840         re.createCSV(new File("C:\\Temp\\test.csv"), ',', Language.getLanguage());
841         re.createHTML(new File("C:\\Temp\\test.html"), false, Language.getLanguage());
842         re.createXML(new File("C:\\Temp\\test.xml"));
843         re.createPS(new File ("C:\\Temp\\test.ps"));
844         re.createPDF(new File("C:\\Temp\\test.pdf"));
845         /****/

846         re.print(true, 1, false, "Epson Stylus COLOR 900 ESC/P 2"); // Dialog
847
// re.print(true, 1, false, "HP LaserJet 3300 Series PCL 6"); // Dialog
848
re.print(false, 1, false, "Epson Stylus COLOR 900 ESC/P 2"); // Dialog
849
System.exit(0);
850     }
851 } // ReportEngine
852
Popular Tags