I have a printable class that needs to print some text only on 1 page. The thing is that when I hit print the printer prints 3 pages:
page 1 - with correct content;
page 2 - empty page;
page 3 - page with content translated some how
then the printing stops.
Any help would be appreciated!

Here is the code:
Java Code:
private static final double FACTOR = 2.83;
private double width, height;
private void setupJob(){
// page width and height
width = 75*FACTOR;
height = 50*FACTOR;

job = PrinterJob.getPrinterJob();
pf = new PageFormat();
//PageFormat pf =job.pageDialog(job.defaultPage());
aset = new HashPrintRequestAttributeSet();
// Create a letter sized piece of paper with one inch margins
paper = new Paper();
// resize the paper and the imageable area
paper.setSize(width, height);
paper.setImageableArea(0, 0, width, height);
// set paper for the pageFormat
// set the job printable by calling the painter of this object with the pf pageFormat
job.setPrintable(this, pf);
// set the media printable area in mm
aset.add(new MediaPrintableArea( 0f, 0f, 75f, 50f, MediaPrintableArea.MM));

try {
} catch (PrinterException e) {

public int print(Graphics g, PageFormat pf, int page)
[INDENT]throws PrinterException {
if (page > 0) { // We have only one page
Graphics2D g2d = (Graphics2D)g;
// no translation needed
// g2d.translate(11.34f, 0);
// scale to fit page size
double sx = 0, sy = 0;
sx = width/(75*4);
sy = height/(50*4);
double scale = Math.min(sx, sy);

// draw the elements
[INDENT]for (int i=0; i<4; i++){