{
String tiffG3Path = "src/test/resources/org/apache/pdfbox/pdmodel/graphics/image/ccittg3.tif";
String tiffG4Path = "src/test/resources/org/apache/pdfbox/pdmodel/graphics/image/ccittg4.tif";
PDDocument document = new PDDocument();
RandomAccess reader = new RandomAccessFile(new File(tiffG3Path), "r");
PDImageXObject ximage3 = CCITTFactory.createFromRandomAccess(document, reader);
validate(ximage3, 1, 344, 287, "tiff", PDDeviceGray.INSTANCE.getName());
BufferedImage bim3 = ImageIO.read(new File(tiffG3Path));
checkIdent(bim3, ximage3.getOpaqueImage());
PDPage page = new PDPage(PDRectangle.A4);
document.addPage(page);
PDPageContentStream contentStream = new PDPageContentStream(document, page, true, false);
contentStream.drawXObject(ximage3, 0, 0, ximage3.getWidth(), ximage3.getHeight());
contentStream.close();
reader = new RandomAccessFile(new File(tiffG4Path), "r");
PDImageXObject ximage4 = CCITTFactory.createFromRandomAccess(document, reader);
validate(ximage4, 1, 344, 287, "tiff", PDDeviceGray.INSTANCE.getName());
BufferedImage bim4 = ImageIO.read(new File(tiffG3Path));
checkIdent(bim4, ximage4.getOpaqueImage());
page = new PDPage(PDRectangle.A4);