Hi,
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!
Thanks!

Here is the code:
Java Code:
private static final double FACTOR = 2.83;
[INDENT]
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
pf.setPaper(paper);
// set the job printable by calling the painter of this object with the pf pageFormat
job.setPrintable(this, pf);
job.setCopies(1);
// set the media printable area in mm
aset.add(new MediaPrintableArea( 0f, 0f, 75f, 50f, MediaPrintableArea.MM));

try {
[INDENT]job.print(aset);[/INDENT]
} catch (PrinterException e) {
[INDENT]e.printStackTrace();[/INDENT]
}[/INDENT]
}

@Override
public int print(Graphics g, PageFormat pf, int page)
[INDENT]throws PrinterException {
if (page > 0) { // We have only one page
[INDENT]return NO_SUCH_PAGE;[/INDENT]
}else{
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);
g2d.scale(scale,scale);

// draw the elements
[INDENT]for (int i=0; i<4; i++){
[INDENT]texts.drawText(g);[/INDENT]
}[/INDENT]
}
return PAGE_EXISTS;[/INDENT]
}