// if the mask has the wrong colorspace (PDFBOX-2057), but it is still useful
// if something goes wrong in the future and we want to have a PDF to open.
PDPage page = new PDPage();
document.addPage(page);
PDPageContentStream contentStream = new PDPageContentStream(document, page, true, false);
contentStream.drawXObject(ximage, 150, 300, ximage.getWidth(), ximage.getHeight());
contentStream.drawXObject(ximage, 200, 350, ximage.getWidth(), ximage.getHeight());
// Example to use rotation, also posted to
// http://stackoverflow.com/a/23876858/535646
AffineTransform at = new AffineTransform(ximage.getWidth() / 4, 0, 0, ximage.getHeight() / 4, 100, 600);