How send drawing to printer

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How send drawing to printer

imhy
Hi, all.
I`m working on a some simple java 2D CAD viewer.
My task is send drawing to a printer. So user must select paper size it can be A4 paper or 1.5m x 5m  (for plotter) so i`m not shure that it is possible to save as image.
After that i need scale my drawing to this paper size and print it on a single page.
I need print whole drawing even  if it not fit on current screen (during resize by user).

Please can You advise how to do this best way?
Reply | Threaded
Open this post in threaded view
|

Re: How send drawing to printer

jmaasing
It is unclear what your question have to do with JOGL (Java OpenGL binding).

Maybe this will help you get started with printing:
https://docs.oracle.com/javase/tutorial/2d/printing/
Reply | Threaded
Open this post in threaded view
|

Re: How send drawing to printer

imhy
Now I`m drawing on a GLCanvas.
I use GL2 calls.
So can I print content of GLCanvas to printer with selected paper size? I see some AWTPrintLifecycle inteface that implemented in GLCanvas.

Contents of GLCanvas changed during user interaction (scale, translate) but I need print whole scene in initial state.
So may be I need prepare some special GLCanvas that i can print?



Reply | Threaded
Open this post in threaded view
|

Re: How send drawing to printer

gouessej
Administrator
Have you looked at the unit tests? Look at the methods setupPrint(), print() and releasePrint().
Julien Gouesse | Personal blog | Website