aspose file tools*
The moose likes Java in General and the fly likes using printer device fonts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "using printer device fonts" Watch "using printer device fonts" New topic

using printer device fonts

simo mon

Joined: Nov 23, 2010
Posts: 2
Hi i have a little bit of experience printing in java..

i can query devices, get printerService attributes, and print using printable interface using a graphics 2d object all ok..

i have made a system which needs to print receipts, and using the graphics stuff makes the receipts far too light, i contacted the manufacturer and they said to use the printers native font ?

i have been playing around with this for a few days now and can't seem to get anything happening....

is there an "easy" or "standard" way to use the printers device fonts, i have been reading the api's but alot of that is beyond my scope atm

any help would be greatly appreciated

Darryl Burke

Joined: May 03, 2008
Posts: 4642

Simo, welcome to the Ranch! Please BeForthrightWhenCrossPostingToOtherSites

luck, db
There are no new questions, but there may be new answers.
simo mon

Joined: Nov 23, 2010
Posts: 2
thanks for the heads up and sorry didn't occur to me that this was bad

everyone i "cross posted" this on the above link and i will cross post the solution.. once i get there

this is probably in the class of " your on your own with that one " so i'll put up what i got in case someone else is struggling

i worked out a way to communicate directly to the printer by sending stuff ( hex codes ) to COM1 BUT !!! this only works windows and on the machine that the printer is connected to

i have also worked out how to use the java printing stuff so that it uses the "printer defined font"

so the above code will use the default font for the printer, which is the "DocFlavor.BYTE_ARRAY.AUTOSENSE" part....

what i am trying to do now is combine part1 code with part2 code...

ie i am trying to send hex values to the printer using code like part2

Iv'e got a really ugly solution which is using an rmi server to call com1 on the correct machine but i want to try to avoid using it ???

any help or insight would be appreciated :

thanks again

and sorry for the un announced cross posting !

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 39436
. . . and welcome to JavaRanch
wood burning stoves
subject: using printer device fonts