1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| @Override
public PageFormat getPageFormat(int pageIndex)
throws IndexOutOfBoundsException {
if (pageIndex >= numPages) {
throw new IndexOutOfBoundsException();
}
PageFormat pf = new PageFormat();
Paper paper= new Paper();
double w=(72.0*29.7/2.54);
double h=(72.0*21.0/2.54);
paper.setSize(w, h);
double scaleX = w / this.getWidth();
double scaleY = h / this.getHeight();
paper.setImageableArea(
borderWidth*scaleX,
borderWidth*scaleY,
w - 2*borderWidth*scaleX,
h - 2*borderWidth*scaleY);
pf.setPaper(paper);
return pf;
} |
Partager