Win a copy of Penetration Testing Basics this week in the Security forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Printing API Question

Brian Mozhdehi
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi - I have a file coded in the native command language of the printer I need to print to. Its an Intermec Barcode printer and the file I have is in IPL language with all necessary data populated to print a barcode on the printer. I have this in file format bu of course can also get this as a string.

I want to send this string directly to the printer, i.e. as text direct to the printer. The printer is installed in Windows as a Generic/Text printer. When I use the print API, it forces me to define this as a type the printer supports, closest I can see is image/gif and then when I do this, the label does not print.

The data is correct because I can open a command prompt and type copy/b <filename> <printer> and it works fine.

Is what I am tying to do possible using the Java Print API? It seems like this forces the user into a series of steps defining document flavors other than just "printer command text", etc which I dont know but suspect is messing with my data prior to sending it. Is it possible to open a direct socket connection to a printer? Or do I have to use RunTime.exec and the copy command?

Any help would be greatly appreciated
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic