Reputation: 6676
I have this link, and I can use this sample, to print my panel: print example I use this, to print my panel:
PrintUtilities.printComponent(this);
"this" is the panel. but after the printing, on the paper the panel is not full. Only the (about) 70% of the Width, and 60% of the Height. (sorry for my english, i am hungarian) The panel size is: 850x1160. This is the example size to an A4 paper: 595x842 -> 70dpi = A4. Please help me, how to print my panel FULLY to an A4 paper. Thank you!
Upvotes: 0
Views: 579
Reputation: 6676
double factorX = pf.getImageableWidth() / component.getWidth();
double factorY = pf.getImageableHeight() / component.getHeight();
double factor = Math.min( factorX, factorY );
g2.scale(factor,factor);
thanks for the answers everybody!
Upvotes: 1