@Test
public void shrinkContentYesBoxes() throws IOException, TaskIOException {

    try (PDDocument document = PDFParser.parse(SeekableSources
            .inMemorySeekableSourceFrom(getClass().getClassLoader().getResourceAsStream("pdf/one_page.pdf")))) {
        PDPage page = document.getPage(0);
        PDRectangle yesBox = new PDRectangle(0, 0, 200, 400);
        PDRectangle cropBox = new PDRectangle(0, 0, 400, 800);
        page.setCropBox(cropBox);
        page.setArtBox(yesBox);
        page.setTrimBox(yesBox);
        page.setBleedBox(yesBox);
        PdfScaler scaler = new PdfScaler(ScaleType.CONTENT);
        scaler.scale(document, 0.5);
        assertEquals(new PDRectangle(0, 0, 595, 842), page.getMediaBox());
        assertEquals(cropBox, page.getCropBox());
        assertEquals(new PDRectangle(150, 300, 100, 200), page.getArtBox());
        assertEquals(new PDRectangle(150, 300, 100, 200), page.getBleedBox());
        assertEquals(new PDRectangle(150, 300, 100, 200), page.getTrimBox());
    }
}