From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Harihar Krishnan Newsgroups: gmane.os.tru64.managers Subject: Printing Issue... Date: Wed, 06 Oct 2004 12:18:40 +0300 Sender: tru64-unix-managers-owner@ornl.gov Message-ID: <89DC8551D0740C4FBAF0BE56680783DDDA6318@mail1srv.bma.gov.bh> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Trace: sea.gmane.org 1097054449 22009 80.91.229.6 (6 Oct 2004 09:20:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 6 Oct 2004 09:20:49 +0000 (UTC) Original-X-From: tru64-unix-managers-owner-gotm-tru64-unix-managers=m.gmane.org@sws1.ctd.ornl.gov Wed Oct 06 11:20:34 2004 Return-path: Original-Received: from sws1.ornl.gov ([160.91.1.101]) by deer.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 1CF7yL-0007bx-00 for ; Wed, 06 Oct 2004 11:20:34 +0200 Original-Received: (qmail 31980 invoked by uid 5); 6 Oct 2004 09:19:37 -0000 Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 31965 invoked by uid 49501); 6 Oct 2004 09:19:37 -0000 Original-Received: from harik@bma.gov.bh by sws1 by uid 49491 with qmail-scanner-1.21 (clamdscan: 0.70-rc. iscan: v3.1/v5.600-1011/847/50540. spamassassin: 2.63. Clear:RC:0(160.91.4.110):SA:0(-4.9/5.0):. Processed in 2.66034 secs); 06 Oct 2004 09:19:37 -0000 Original-Received: from unknown (HELO emroute3.ornl.gov) (160.91.4.110) by 0 with SMTP; 6 Oct 2004 09:19:34 -0000 Original-Received: from emroute3.ornl.gov (localhost [127.0.0.1]) by emroute3.ornl.gov (PMDF V6.2-X27 #30899) with ESMTP id <0I55003UWOKLQW@emroute3.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Wed, 06 Oct 2004 05:19:33 -0400 (EDT) Original-Received: from VIRUSCAN-DAEMON.emroute3.ornl.gov by emroute3.ornl.gov (PMDF V6.2-X27 #30899) id <0I5500A02OKHD2@emroute3.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Wed, 06 Oct 2004 05:19:31 -0400 (EDT) Original-Received: from xsrv.bmagtway.gov.bh ([217.17.227.178]) by emroute3.ornl.gov (PMDF V6.2-X27 #30899) with ESMTP id <0I55008C1OKFAK@emroute3.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Wed, 06 Oct 2004 05:19:29 -0400 (EDT) Original-Received: from mail1srv.bma.gov.bh (IS~MAIL1SRV [192.168.1.2]) by xsrv.bmagtway.gov.bh with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2657.72) id SZ72GJXT; Wed, 06 Oct 2004 12:00:34 +0300 Original-Received: by mail1srv.bma.gov.bh with Internet Mail Service (5.5.2657.72) id ; Wed, 06 Oct 2004 12:18:41 +0300 Content-return: allowed Original-To: 'Tru64 User Group' X-Mailer: Internet Mail Service (5.5.2657.72) Xref: main.gmane.org gmane.os.tru64.managers:7639 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:7639 Dear Printing Experts, We connected an Epson LQ-680 dot-matrix printer to the parallel port of Host1 (DS10, Tru64 v5.1) and created a printer using "lprsetup". We tried to execute a java script (see below) and used the command "java TestBankPrinting" under Unix to print its output. The output on the printer should be the string "89658958". However, the printer prints some long driver text titled "!PS - Adobe" etc.etc. It may be noted that when we run the same script from a Windows client and send the output to a network laser printer, the correct string is printed. When setting up the printer driver under Unix, we tried using a few printer types including "unknown", "ep1050+", "fx80" "PS level 1" "PS level 2", etc. but none of these achieved the targeted output. The question now is: Which printer type should I select for my Epson LQ-680 to print the Java script output? You may also note that the printer prints normal files (e.g. /etc/hosts) without any problems, even when we select "unknown" as printer type. We would appreciate a feedback from the Print whizkids. Thanks in advance. ============================================================================ =================== THE JAVA SCRIPT IS AS FOLLOWS: import java.awt.*; import java.awt.font.*; import java.awt.geom.*; import java.awt.print.*; import java.text.*; public class TestBankPrinting implements Printable //public class TestBankPrinting { private static final String printText = "89658958"; private static final AttributedString printStyle = new AttributedString(printText); public static void main(String[] args) { TestBankPrinting testBankPrinting = new TestBankPrinting(); PrinterJob printerJob = PrinterJob.getPrinterJob(); PageFormat format = new PageFormat(); //Choose printing type //format = printerJob.pageDialog(format); format = printerJob.defaultPage(); //Paper paper=new Paper(); Book book = new Book(); book.append(new TestBankPrinting(), format); printerJob.setPageable(book); //printerJob.setPageable(book); try { printerJob.print(); } catch (PrinterException exception) { System.err.println("Printing error: " + exception); } } public int print(Graphics g, PageFormat format, int pageIndex) throws PrinterException { Graphics2D g2d = (Graphics2D) g.create(); g2d.translate(format.getImageableX(), format.getImageableY()); Point2D.Float pen = new Point2D.Float(); AttributedCharacterIterator charIterator = printStyle.getIterator(); LineBreakMeasurer measurer = new LineBreakMeasurer(charIterator, g2d.getFontRenderContext()); float wrappingWidth = (float) format.getImageableWidth(); while (measurer.getPosition() < charIterator.getEndIndex()) { TextLayout layout = measurer.nextLayout(wrappingWidth); pen.y += layout.getAscent(); float dx = layout.isLeftToRight() ? 0 : (wrappingWidth - layout.getAdvance()); layout.draw(g2d, pen.x + dx, pen.y); pen.y += layout.getDescent() + layout.getLeading(); } g2d.dispose(); g2d = null; try { Printable formatPainter = (Printable) format; formatPainter.print(g, format, pageIndex); } catch (ClassCastException exception) {} return Printable.PAGE_EXISTS; } } ============================================================================ =================== Harihar K =========================================================================== DISCLAIMER: "This communication is intended solely for the named recipient and others authorized to receive it. It may contain confidential or legally privileged information. If you are not the intended recipient, please notify us immediately, and note that any disclosure, copying, distribution or action you may take in reliance on this communication is strictly prohibited and may be unlawful. Unless indicated otherwise, this communication is not intended nor should it be taken to create any legal relations, contractual or otherwise. Bahrain Monetary Agency(BMA) is neither liable for the proper and complete transmission of the communication, nor for any delay in its receipt. Whilst BMA undertakes all reasonable efforts to screen outgoing e-mails for viruses, it cannot be held liable for any viruses transmitted by this e-mail." ===========================================================================