PdfViewerPreferences extends PdfObjectWrapper<PdfDictionary> { public PdfViewerPreferences setPrintClip(PdfViewerPreferencesConstants pageBoundary) { return setPageBoundary(PdfViewerPreferencesConstants.PRINT_CLIP, pageBoundary); } PdfViewerPreferences();  PdfViewerPreferences(PdfDictionary pdfObject); PdfViewerPreferences setHideToolbar(boolean hideToolbar); PdfViewerPreferences setHideMenubar(boolean hideMenubar); PdfViewerPreferences setHideWindowUI(boolean hideWindowUI); PdfViewerPreferences setFitWindow(boolean fitWindow); PdfViewerPreferences setCenterWindow(boolean centerWindow); PdfViewerPreferences setDisplayDocTitle(boolean displayDocTitle); PdfViewerPreferences setNonFullScreenPageMode(PdfViewerPreferencesConstants nonFullScreenPageMode); PdfViewerPreferences setDirection(PdfViewerPreferencesConstants direction); PdfViewerPreferences setViewArea(PdfViewerPreferencesConstants pageBoundary); PdfViewerPreferences setViewClip(PdfViewerPreferencesConstants pageBoundary); PdfViewerPreferences setPrintArea(PdfViewerPreferencesConstants pageBoundary); PdfViewerPreferences setPrintClip(PdfViewerPreferencesConstants pageBoundary); PdfViewerPreferences setPrintScaling(PdfViewerPreferencesConstants printScaling); PdfViewerPreferences setDuplex(PdfViewerPreferencesConstants duplex); PdfViewerPreferences setPickTrayByPDFSize(boolean pickTrayByPdfSize); PdfViewerPreferences setPrintPageRange(int[] printPageRange); PdfViewerPreferences setNumCopies(int numCopies); PdfViewerPreferences setEnforce(PdfArray enforce); PdfArray getEnforce(); PdfViewerPreferences put(PdfName key, PdfObject value);  }
@Test public void printClipTest() { PdfViewerPreferences preferences = new PdfViewerPreferences(); PdfDictionary dictionary = preferences.getPdfObject(); Assert.assertEquals(0, dictionary.size()); preferences.setPrintClip(PdfViewerPreferences.PdfViewerPreferencesConstants.PRINT_AREA); Assert.assertEquals(0, dictionary.size()); preferences.setPrintClip(PdfViewerPreferences.PdfViewerPreferencesConstants.CROP_BOX); Assert.assertEquals(1, dictionary.size()); Assert.assertEquals(PdfName.CropBox, dictionary.get(PdfName.PrintClip)); preferences.setPrintClip(PdfViewerPreferences.PdfViewerPreferencesConstants.ART_BOX); Assert.assertEquals(1, dictionary.size()); Assert.assertEquals(PdfName.ArtBox, dictionary.get(PdfName.PrintClip)); preferences.setPrintClip(PdfViewerPreferences.PdfViewerPreferencesConstants.BLEED_BOX); Assert.assertEquals(1, dictionary.size()); Assert.assertEquals(PdfName.BleedBox, dictionary.get(PdfName.PrintClip)); preferences.setPrintClip(PdfViewerPreferences.PdfViewerPreferencesConstants.MEDIA_BOX); Assert.assertEquals(1, dictionary.size()); Assert.assertEquals(PdfName.MediaBox, dictionary.get(PdfName.PrintClip)); preferences.setPrintClip(PdfViewerPreferences.PdfViewerPreferencesConstants.TRIM_BOX); Assert.assertEquals(1, dictionary.size()); Assert.assertEquals(PdfName.TrimBox, dictionary.get(PdfName.PrintClip)); }