From owner-freebsd-java@FreeBSD.ORG Mon Sep 4 00:31:46 2006 Return-Path: X-Original-To: freebsd-java@freebsd.org Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 08D5616A4DA for ; Mon, 4 Sep 2006 00:31:46 +0000 (UTC) (envelope-from nb_root@videotron.ca) Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id AF83C43D45 for ; Mon, 4 Sep 2006 00:31:43 +0000 (GMT) (envelope-from nb_root@videotron.ca) Received: from clk01a ([24.202.77.103]) by VL-MH-MR001.ip.videotron.ca (Sun Java System Messaging Server 6.2-2.05 (built Apr 28 2005)) with ESMTP id <0J5100KQBLGUSF63@VL-MH-MR001.ip.videotron.ca> for freebsd-java@freebsd.org; Sun, 03 Sep 2006 20:31:42 -0400 (EDT) Date: Sun, 03 Sep 2006 20:31:36 -0400 From: Nicolas Blais To: freebsd-java@freebsd.org Message-id: <200609032031.42080.nb_root@videotron.ca> MIME-version: 1.0 Content-type: multipart/signed; boundary=nextPart6593792.PQd671nSxB; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-transfer-encoding: 7bit User-Agent: KMail/1.9.3 Subject: Printing with java under FreeBSD X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Sep 2006 00:31:46 -0000 --nextPart6593792.PQd671nSxB Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, I've been developing several applications in Java (diablo-jdk15) and am qui= te=20 satisfied with the result on FreeBSD and other OS.=20 My only complaint so far is that I haven't had any success printing with Ja= va.=20 I'm using CUPS-1.2.2.=20 Every little bits of code I find on the net do not work in FreeBSD. Is this= a=20 known issue? Any workaround? Here's one small bit of code I've tried to get to work, but throws an=20 exception: //START import java.awt.*; import java.awt.print.*; import java.awt.geom.*; class PrintObject implements Printable { public int print (Graphics g, PageFormat f, int pageIndex) { Graphics2D g2 =3D (Graphics2D) g; // Allow use of Java 2 graphics on // the print pages : Rectangle2D rect =3D new Rectangle2D.Double(f.getImageableX(), f.getImageableY(), f.getImageableWidth(), f.getImageableHeight()); Ellipse2D circle =3D new Ellipse2D.Double(100,100,100,100); switch (pageIndex) { case 0 : g2.setColor(Color.black); // Page 1 : print a rectangle g2.draw(rect); return PAGE_EXISTS; case 1 : g2.setColor(Color.red); // Page 2 : print a circle g2.draw(circle); return PAGE_EXISTS; default: return NO_SUCH_PAGE; // No other pages } } } public class Sample1 { public static void main (String[] args) { PrinterJob job =3D PrinterJob.getPrinterJob(); job.setPrintable(new PrintObject()); if (job.printDialog()) { try { job.print(); } catch (PrinterException e) { System.out.println(e); } } } } //END =2D-=20 =46reeBSD 7.0-CURRENT #18: Sat Sep 2 14:06:41 EDT 2006 =20 root@clk01a:/usr/obj/usr/src/sys/CLK01A=20 PGP? : http://www.clkroot.net/security/nb_root.asc --nextPart6593792.PQd671nSxB Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQBE+3Pu4wTBlvcsbJURAu4eAJ9z2lBSdUt9VWME/eXePTznc7JwfQCghl1j 0BIUMh1yLLEELqKfmM9pfUk= =G2hO -----END PGP SIGNATURE----- --nextPart6593792.PQd671nSxB--