Re: Printing the Display

Hi Mike,

Unfortunately, none of the VisAD authors are experts on the
java.awt.print API.  Support for printing VisAD displays was
added because someone requested it, and it wasn't difficult.

It may be a bug in the JDK.  If you are not using the latest
version of the JDK, try upgrading and see if that fixes the

Alternately, you could use visad.util.Util.captureDisplay
to save a display to a JPEG file, then use an image editing
program to print the JPEG.

Good luck,

At 02:41 PM 6/20/2002, you wrote:
>I saw on the mailing list that someone posted a message with a similar
>problem but it was never answered, so here goes again:
>The problem:  When I print my image in visAD (to a printer or to file)
>it will crop off some of the right edge and the bottom edge of the
>Has anyone else experienced this?
>Does anyone know how to fix this?
>Below is my code to print:
>// this printGraph() method is a member of my class that has a
>// DisplayImplJ3D named "display"
>public void printGraph()
>  class BasicThread extends Thread
>  {
>    public void run()
>    {
>      PrinterJob printJob = PrinterJob.getPrinterJob();
>      Printable p = display.getPrintable();
>      printJob.setPrintable(p);
>      try
>      {
>        if(printJob.printDialog()) printJob.print();
>      } catch(PrinterException printexception)
>          { System.out.println("PrinterException"); }
>    }
>  }
>  // Create a thread and run it
>  Thread thread = new BasicThread();
>  thread.start();