This is all between you, jasper reports, and your printer.
AUTOSENSE basically just pumps the data in the file to the printer port (via GDI APIs). Not really different than : copy bill.html LPT1: So you can only send via AUTOSENSE something your printer understands. For dot matrix printers basic ASCII text with newlines, tabs etc is probably OK But its a bit suspicious that your file name ends with .html I doubt there's a dot matrix printer in the world that can render HTML directly -phil. [EMAIL PROTECTED] wrote:
I have a dot matrix printer nad i want to print data directly to the dot matrix printer. I have use the JasperReport as reporting tool but it prints very slowly. I have also use the JRTextExporter exporter = new JRTextExporter(); for exporting reports in text but it can't make a good alignment to the text and event i can't do any type of formatting in the text File. My Code is [b]public void convertToText[/b]() { JRTextExporter exporter = new JRTextExporter(); File file = new File("C:\\bill.html"); try { exporter.setParameter(JRTextExporterParameter.JASPER_PRINT,report.getReport()); exporter.setParameter(JRTextExporterParameter.OUTPUT_FILE, file); exporter.setParameter(JRTextExporterParameter.PAGE_HEIGHT,new Integer(15)); exporter.setParameter(JRTextExporterParameter.PAGE_WIDTH,new Integer(22)); exporter.setParameter(JRTextExporterParameter.CHARACTER_WIDTH,new Integer(30)); exporter.setParameter(JRTextExporterParameter.CHARACTER_HEIGHT,new Integer(30)); exporter.exportReport(); getPrinter(file); } catch (Exception ex) { ex.printStackTrace(); } } [b]public void getPrinter[/b](File file) throws PrintException, FileNotFoundException { javax.print.DocFlavor flavor = javax.print.DocFlavor.INPUT_STREAM.AUTOSENSE; javax.print.attribute.PrintRequestAttributeSet pras = new javax.print.attribute.HashPrintRequestAttributeSet(); PrintService printService = PrintServiceLookup.lookupDefaultPrintService(); javax.print.DocPrintJob job = printService.createPrintJob(); java.io.FileInputStream fis = new java.io.FileInputStream(file); javax.print.attribute.DocAttributeSet das = new javax.print.attribute.HashDocAttributeSet(); javax.print.Doc doc = new javax.print.SimpleDoc(fis, flavor, das); job.print(doc, pras); } } [Message sent by forum member 'aroop_bh' (aroop_bh)] http://forums.java.net/jive/thread.jspa?messageID=227537 =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".