PaperClips integration with nattable

23 views
Skip to first unread message

Alexander Gavrilov

unread,
Apr 3, 2012, 8:03:36 AM4/3/12
to SWT PaperClips
Hi, I am trying to print nattable, using PaperClips. First of all my
approach was to create an image representation of nattable and then
create an ImagePrint. It works fine, but the problem is that nattable
I our project can be really big, which means that image is also big
and there are a lot of problems with OutOfMemoryError.

Now, I am thinking, that the best solution would be to draw nattable
directly on the gc, which is provided by PaperClips during
PrintPiece#paint. Unfortunately, nattable needs to get rectangle,
which should be drawn, but in PrintPiece#paint method there are only x
and y coordinates (there is information about full nattable width and
height thou).

Is there a way to implement such functionality?
How it would be possible to get width and height of printable area
(considering previous scaling, transformations and so on, which are
done by parent prints, for instance, ScalePrint)?
If someone is familiar with nattable, can you propose some algorithm/
solution of printing nattable?

Matthew Hall

unread,
Apr 11, 2012, 4:12:00 PM4/11/12
to swt-pap...@googlegroups.com
Since the print piece is supposed to know its own size (see PrintPiece.getSize()), you should be able to call getSize() to infer the rectangle needed by NatTable.

If you can share the code for your NatTable printer I might be able to provide better help.

-Matthew
Reply all
Reply to author
Forward
0 new messages