xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: More Info: Card Printing and Mag Stripe Encoding
Date Thu, 15 Jun 2006 09:50:02 GMT
Hi Ted,

"Ted Young" <tyoung@ncoastsoft.com> wrote on 06/14/2006 04:35:04 PM:

> Well, through some more investigation and trial-and-error, I have found 
> by using gradients anywhere on my document, all text in my document IS 
> rasterized before going to the printer.  By taking the gradients out, 
once can
> notice substantially clearer text.  Text that overlaps images is also 
> I am assuming, at this point, that this rasterization is occurring at 
the whim
> of the Graphics object.  I will pursue that possibility next.

   Yes, the print method is actually called multiple times, the first
time it 'scopes things out' and tries to identify regions where it will
have to rasterize content (opacity and bitmaps, etc).  Then it actually
calls your print method to generate output (usually in stripes so this
may involve a great many calls).  I should note that this is the JVM's
Graphics object, not ours...

   If your drawing has an empty border around it (common for cards) I
would try drawing the text there as long as any part of the text is
'on the page' it should be included, hopefully.

   Anyway, good luck!

> From: Ted Young [mailto:tyoung@ncoastsoft.com] 
> Sent: Wednesday, June 14, 2006 2:59 PM
> To: batik-users@xmlgraphics.apache.org
> Subject: Card Printing and Mag Stripe Encoding
> 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 
> into is that I need to transmit a string of text to the printer to be 
> on the mag stripe.
> I am using Fargo’s DTC 550 LC printer.  When it encounters a string of 
> 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 
> along with any other text and graphics, and the printer will detect it 
> 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 
> the printer as text (not as glyphs or raster) since the printer will 
> black TrueType data in pure black (allowing for things like barcodes). 
> 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 
> 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 
> settings.add(OrientationRequested.PORTRAIT);
> settings.add(new JobName(title, null));
> settings.add(new MediaPrintableArea(0f, 0f, 2.125f, 3.375f, 
> DocPrintJob printJob = Configuration.printer.createPrintJob();
> SimpleDoc doc = new SimpleDoc(transcoder, 
> 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 
> driver, so I tried:
> Printable p = new Printable() {
>             public int print(Graphics graphics, PageFormat pageFormat, 
> pageIndex) throws PrinterException {
>                         if (pageIndex == 0) {
>                                     graphics.drawString("~1%123?", 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 
> Printable p = new Printable() {
>             public int print(Graphics graphics, PageFormat pageFormat, 
> pageIndex) throws PrinterException {
>                         if (pageIndex == 0) {
>                                     graphics.drawString("~1%123?", 10, 
>                         return transcoder.print(graphics, pageFormat, 
>             }
> };
> 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
View raw message