PDXObjectImage ximage2 = new PDPixelMap(document, rectImage);
PDPage page = new PDPage();
document.addPage(page);
PDPageContentStream contentStream = new PDPageContentStream(document, page, true, false);
contentStream.drawXObject(ximage2, 150, 300, ximage2.getWidth(), ximage2.getHeight());
contentStream.drawXObject(ximage, 150, 300, ximage.getWidth(), ximage.getHeight());
contentStream.drawXObject(ximage.getSMaskImage(), 150, 0, ximage.getSMaskImage().getWidth(), ximage.getSMaskImage().getHeight());
contentStream.close();
File pdfFile = new File(testResultsDir, pdfFilename);
document.save(pdfFile);