From batik-users-return-10566-apmail-xmlgraphics-batik-users-archive=xmlgraphics.apache.org@xmlgraphics.apache.org Wed Jun 14 18:53:02 2006 Return-Path: Delivered-To: apmail-xmlgraphics-batik-users-archive@www.apache.org Received: (qmail 42722 invoked from network); 14 Jun 2006 18:53:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Jun 2006 18:53:02 -0000 Received: (qmail 18738 invoked by uid 500); 14 Jun 2006 18:53:01 -0000 Delivered-To: apmail-xmlgraphics-batik-users-archive@xmlgraphics.apache.org Received: (qmail 18606 invoked by uid 500); 14 Jun 2006 18:53:00 -0000 Mailing-List: contact batik-users-help@xmlgraphics.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: batik-users@xmlgraphics.apache.org Delivered-To: mailing list batik-users@xmlgraphics.apache.org Received: (qmail 18595 invoked by uid 99); 14 Jun 2006 18:53:00 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Jun 2006 11:53:00 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [72.43.91.130] (HELO mx1.nyhost.net) (72.43.91.130) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Jun 2006 11:52:59 -0700 Received: from ATUM (rrcs-72-43-91-253.nys.biz.rr.com [72.43.91.253]) by mx1.nyhost.net (Postfix) with ESMTP id AC9DB21307D for ; Wed, 14 Jun 2006 14:30:41 -0400 (EDT) From: "Ted Young" To: Subject: Card Printing and Mag Stripe Encoding Date: Wed, 14 Jun 2006 14:58:52 -0400 Message-ID: <009101c68fe4$946b8e30$7701a8c0@ATUM> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0092_01C68FC3.0D59EE30" X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 Thread-Index: AcaP5JQQxoxaR0jVSG2V2/RSTnrziA== X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_NextPart_000_0092_01C68FC3.0D59EE30 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Good day to everyone, I am using Batik to dynamically generate ID cards (XML + XSL = SVG -> Batik/Printer). The whole thing works great. The only problem I am running into is that I need to transmit a string of text to the printer to be encoded on the mag stripe. I am using Fargo's DTC 550 LC printer. When it encounters a string of text like ~1%123? It will, instead of printing that string, encode 123 on track 1 of the mag stripe. I can open up Word, for example, and print this string, along with any other text and graphics, and the printer will detect it and forward it to the mag stripe. However, when I include this string in my SVG, the printer just prints it to the card. I am pretty confident that the text on the card is being sent to the printer as text (not as glyphs or raster) since the printer will print black TrueType data in pure black (allowing for things like barcodes). And, it appears that this is working just fine. My suspicion is that the text string ~1%123? Which I embed in a tag is being broken up with formatting/layout information, but this is just a guess. First, here is how I am printing the SVG documents: PrintTranscoder transcoder = new PrintTranscoder(); transcoder.transcode(new TranscoderInput(svg.front), null); transcoder.transcode(new TranscoderInput(svg.back), null); String title = ((SVGOMDocument)svg.front).getTitle(); HashPrintRequestAttributeSet settings = new HashPrintRequestAttributeSet(); settings.add(OrientationRequested.PORTRAIT); settings.add(new JobName(title, null)); settings.add(new MediaPrintableArea(0f, 0f, 2.125f, 3.375f, MediaSize.INCH)); DocPrintJob printJob = Configuration.printer.createPrintJob(); SimpleDoc doc = new SimpleDoc(transcoder, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null); printJob.print(doc, settings); Thanks for your patience. Here is where it gets a little more interesting. I decided to verify that it isn't something with the Java print service or the driver, so I tried: Printable p = new Printable() { public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { if (pageIndex == 0) { graphics.drawString("~1%123?", 10, 10); return Printable.PAGE_EXISTS; } else { Return Printable.NO_SUCH_PAGE; } } }; This works! The data is sent to the mag encoder. So, I went one step further: Printable p = new Printable() { public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { if (pageIndex == 0) { graphics.drawString("~1%123?", 10, 10); return transcoder.print(graphics, pageFormat, pageIndex); } }; Now we are back to the same problem. The text appears on the card. Would anyone know why this happens, and/or how to work around it. Thank you, Ted Young ------=_NextPart_000_0092_01C68FC3.0D59EE30 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Good day to everyone,

 

I am using Batik to dynamically generate ID cards = (XML + XSL =3D SVG -> Batik/Printer).  The whole thing works great.  = The only problem I am running into is that I need to transmit a string of text to = the printer to be encoded on the mag stripe.

 

I am using Fargo’s DTC 550 LC printer.  When it encounters a string of text like = ~1%123? It will, instead of printing that string, encode 123 on track 1 of the mag = stripe.  I can open up Word, for example, and print this string, along with any = other text and graphics, and the printer will detect it and forward it to the = mag stripe.

 

However, when I include this string in my SVG, the = printer just prints it to the card.  I am pretty confident that the text on = the card is being sent to the printer as text (not as glyphs or raster) = since the printer will print black TrueType data in pure black (allowing for = things like barcodes).  And, it appears that this is working just = fine.

 

My suspicion is that the text string ~1%123? Which I = embed in a <text …></text> tag is being broken up with = formatting/layout information, but this is just a guess.

 

First, here is how I am printing the SVG = documents:

 

PrintTranscoder transcoder =3D new = PrintTranscoder();

transcoder.transcode(new TranscoderInput(svg.front), = null);

transcoder.transcode(new TranscoderInput(svg.back), = null);

 

String title =3D = ((SVGOMDocument)svg.front).getTitle();

         =             &= nbsp; 

HashPrintRequestAttributeSet settings =3D new HashPrintRequestAttributeSet();

settings.add(OrientationRequested.PORTRAIT);

settings.add(new JobName(title, = null));

settings.add(new MediaPrintableArea(0f, 0f, 2.125f, = 3.375f, MediaSize.INCH));

 

DocPrintJob printJob =3D Configuration.printer.createPrintJob();

SimpleDoc doc =3D new SimpleDoc(transcoder, DocFlavor.SERVICE_FORMATTED.PRINTABLE, = null);

printJob.print(doc, = settings);

 

 

Thanks for your patience.  Here is where it gets = a little more interesting.  I decided to verify that it isn’t something with the Java print service or the driver, so I = tried:

 

Printable p =3D new Printable() = {

         =    public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) = throws PrinterException {

         =             &= nbsp;  if (pageIndex =3D=3D 0) {

         =             &= nbsp;           &n= bsp;  graphics.drawString("~1%123?", 10, 10);

         =             &= nbsp;           &n= bsp;  return Printable.PAGE_EXISTS;

         =             &= nbsp;  } else {

         =             &= nbsp;           &n= bsp;  Return Printable.NO_SUCH_PAGE;

         =             &= nbsp;  }

         =    }

};

 

This works!  The data is sent to the mag = encoder.  So, I went one step further:

 

Printable p =3D new Printable() = {

         =    public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) = throws PrinterException {

         =             &= nbsp;  if (pageIndex =3D=3D 0) {

         =             &= nbsp;           &n= bsp;  graphics.drawString("~1%123?", 10, 10);

         =             &= nbsp;  return transcoder.print(graphics, pageFormat, = pageIndex);

         =    }

};

 

Now we are back to the same problem.  The text = appears on the card.

 

Would anyone know why this happens, and/or how to = work around it.

 

Thank you,

 

Ted Young

 

------=_NextPart_000_0092_01C68FC3.0D59EE30--