May 10, 2007

HPGL Output from Java : Vector Printing ,Not Raster

Filed under: Java — khangharoth @ 2:37 pm

Currently i am working to implement a Plotter functionality in our Java based CAD Application.

If we use normal printing ways or more precisely Raster printing ,life is very easy.It can be summed up as

  • Create a Raster Buffer .We can do this by say capturing a screen shot and prepares a Buffered Image.
  • Set up Java printing interface.
  • Send this Raster data to printer.

It’s ok for normal requirements but for Industrial applications like CAD industry you don’t want jagged effects in say line which has been printed.

For high quality smooth printing we have to send data in Vector form to the Printer.

The difference in Vector and Raster data is  ,in Vector to draw a Circle we send something like Circle,center,Radius information to a printer.But in Raster we send all the points or pixel buffer to printer,printer doesn’t know that it is a circle .Its just draws the pixel buffer.

Ways to send Raster Data :GIF,JPEG,PNG.

Ways to send Vector Data :PLT,PostScript.

Now i am trying to do it by PLT format.The problem i am facing is PLT depends on type of printer and so i have to get driver properties and convert neutral .plt file to printer specific .plt file.But by Java i am not been able to get Driver properties.

Still trying to figure a way out !

Note:I am still in R&D phase so i may be wrong in what i have said above.



  1. I’d be interested in how you made out with this. We now have a requirement to output maps to D-size plotters, and window’s print drivers all rasterize the data, even when we send it vectors.

    Comment by Bryan — February 28, 2008 @ 7:11 pm | Reply

  2. I used Java 2D Api’s for printing as in that i can send Vector data.
    It had function like drawLine(pt1 ,pt2)..or drawCircle(centrePt,radius).

    If you will something like GIF,JPEG,PNG then window’s print drivers will rasterize the data.

    Comment by elope — February 29, 2008 @ 4:20 am | Reply

  3. how to Convert a .bmp (BitMaP) file into an .hpg (HP/GL) file ,is it possible with java2d or any?
    help me out if u have any Idea?

    Comment by chandu — June 5, 2008 @ 6:29 am | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at

%d bloggers like this: