I believe the method PDFGraphics.drawImage(Image
img,int x,int y,int w,int h, ImageObserver obs) has an
error with writing out the PDF code
I think w and h are supposed to be width and height in
the PDF's coordinate System (with 72 dpi), but these
parameters are completely ignored:
// q w 0 0 h x y cm % the coordinate matrix
pw.print("q " +
image.getWidth() +
" 0 0 " +
image.getHeight() +
" " + x + " " +
((int)page.getDimension().getHeight()-y-image.getHeight())
+
" cm \n" + image.getName() + " Do\nQ\n");
The comment is correct, the transformation matrix is [
q w 0 0 h x y ], but the w and h are the image's actual
width and height, thus it doesn't get scaled
I think the code should be:
pw.print("q " +
w +
" 0 0 " +
h +
" " + x + " " +
((int)page.getDimension().getHeight()-y-h) +
" cm \n" + image.getName() + " Do\nQ\n");
At least then it behaves as I expect it to ;-)