/** * Sets the target directory. * * @param targetDirectory */ public void setTargetDirectory(PDTargetDirectory targetDirectory) { getCOSObject().setItem(COSName.T, targetDirectory); } }
/** * This will set the file in which the destination is located. * * @param fs The file specification. */ public void setFile(PDFileSpecification fs) { getCOSObject().setItem(COSName.F, fs); }
/** * This will specify whether to open the destination document in a new window, in the same * window, or behave in accordance with the current user preference. * * @return A flag specifying how to open the destination document. */ public OpenMode getOpenInNewWindow() { if (getCOSObject().getDictionaryObject(COSName.NEW_WINDOW) instanceof COSBoolean) { COSBoolean b = (COSBoolean) getCOSObject().getDictionaryObject(COSName.NEW_WINDOW); return b.getValue() ? OpenMode.NEW_WINDOW : OpenMode.SAME_WINDOW; } return OpenMode.USER_PREFERENCE; }
/** * This will specify whether to open the destination document in a new window. * * @param value The flag value. */ public void setOpenInNewWindow(OpenMode value) { if (null == value) { getCOSObject().removeItem(COSName.NEW_WINDOW); return; } switch (value) { case USER_PREFERENCE: getCOSObject().removeItem(COSName.NEW_WINDOW); break; case SAME_WINDOW: getCOSObject().setBoolean(COSName.NEW_WINDOW, false); break; case NEW_WINDOW: getCOSObject().setBoolean(COSName.NEW_WINDOW, true); break; default: // shouldn't happen unless the enum type is changed break; } }
/** * This will get the destination to jump to. * * @return The D entry of the specific go-to action dictionary. * * @throws IOException If there is an error creating the destination. */ public PDDestination getDestination() throws IOException { return PDDestination.create(getCOSObject().getDictionaryObject(COSName.D)); }
/** * This will get the file in which the destination is located. * * @return The F entry of the specific embedded go-to action dictionary. * * @throws IOException If there is an error creating the file spec. */ public PDFileSpecification getFile() throws IOException { return PDFileSpecification.createFS(getCOSObject().getDictionaryObject(COSName.F)); }
/** * Get the target directory. * * @return the target directory or null if there is none. */ public PDTargetDirectory getTargetDirectory() { COSBase base = getCOSObject().getDictionaryObject(COSName.T); if (base instanceof COSDictionary) { return new PDTargetDirectory((COSDictionary) base); } return null; }
/** * This will set the destination to jump to. * * @param d The destination. * * @throws IllegalArgumentException if the destination is not a page dictionary object. */ public void setDestination(PDDestination d) { if (d instanceof PDPageDestination) { PDPageDestination pageDest = (PDPageDestination) d; COSArray destArray = pageDest.getCOSObject(); if (destArray.size() >= 1) { COSBase page = destArray.getObject(0); if (!(page instanceof COSDictionary)) { throw new IllegalArgumentException("Destination of a GoToE action must be " + "a page dictionary object"); } } } getCOSObject().setItem(COSName.D, d); }
/** * This will set the file in which the destination is located. * * @param fs The file specification. */ public void setFile(PDFileSpecification fs) { getCOSObject().setItem(COSName.F, fs); }
/** * Sets the target directory. * * @param targetDirectory the target directory. */ public void setTargetDirectory(PDTargetDirectory targetDirectory) { getCOSObject().setItem(COSName.T, targetDirectory); } }
/** * This will specify whether to open the destination document in a new window, in the same * window, or behave in accordance with the current user preference. * * @return A flag specifying how to open the destination document. */ public OpenMode getOpenInNewWindow() { if (getCOSObject().getDictionaryObject(COSName.NEW_WINDOW) instanceof COSBoolean) { COSBoolean b = (COSBoolean) getCOSObject().getDictionaryObject(COSName.NEW_WINDOW); return b.getValue() ? OpenMode.NEW_WINDOW : OpenMode.SAME_WINDOW; } return OpenMode.USER_PREFERENCE; }
/** * This will specify whether to open the destination document in a new window. * * @param value The flag value. */ public void setOpenInNewWindow(OpenMode value) { if (null == value) { getCOSObject().removeItem(COSName.NEW_WINDOW); return; } switch (value) { case USER_PREFERENCE: getCOSObject().removeItem(COSName.NEW_WINDOW); break; case SAME_WINDOW: getCOSObject().setBoolean(COSName.NEW_WINDOW, false); break; case NEW_WINDOW: getCOSObject().setBoolean(COSName.NEW_WINDOW, true); break; default: // shouldn't happen unless the enum type is changed break; } }
/** * This will get the destination to jump to. * * @return The D entry of the specific go-to action dictionary. * * @throws IOException If there is an error creating the destination. */ public PDDestination getDestination() throws IOException { return PDDestination.create(getCOSObject().getDictionaryObject(COSName.D)); }
/** * This will get the file in which the destination is located. * * @return The F entry of the specific embedded go-to action dictionary. * * @throws IOException If there is an error creating the file spec. */ public PDFileSpecification getFile() throws IOException { return PDFileSpecification.createFS(getCOSObject().getDictionaryObject(COSName.F)); }
/** * Get the target directory. * * @return the target directory or null if there is none. */ public PDTargetDirectory getTargetDirectory() { COSBase base = getCOSObject().getDictionaryObject(COSName.T); if (base instanceof COSDictionary) { return new PDTargetDirectory((COSDictionary) base); } return null; }
/** * This will set the destination to jump to. * * @param d The destination. * * @throws IllegalArgumentException if the destination is not a page dictionary object. */ public void setDestination(PDDestination d) { if (d instanceof PDPageDestination) { PDPageDestination pageDest = (PDPageDestination) d; COSArray destArray = pageDest.getCOSObject(); if (destArray.size() >= 1) { COSBase page = destArray.getObject(0); if (!(page instanceof COSDictionary)) { throw new IllegalArgumentException("Destination of a GoToE action must be " + "a page dictionary object"); } } } getCOSObject().setItem(COSName.D, d); }