Search in sources :

Example 6 with PDFileSpecification

use of org.apache.pdfbox.pdmodel.common.filespecification.PDFileSpecification in project pdfbox by apache.

the class FDFDictionary method getEmbeddedFDFs.

/**
 * This will get the list of embedded FDF entries, or null if the entry is null. This will return a list of
 * PDFileSpecification objects.
 *
 * @return A list of embedded FDF files.
 *
 * @throws IOException If there is an error creating the file spec.
 */
public List<PDFileSpecification> getEmbeddedFDFs() throws IOException {
    List<PDFileSpecification> retval = null;
    COSArray embeddedArray = (COSArray) fdf.getDictionaryObject(COSName.EMBEDDED_FDFS);
    if (embeddedArray != null) {
        List<PDFileSpecification> embedded = new ArrayList<>();
        for (int i = 0; i < embeddedArray.size(); i++) {
            embedded.add(PDFileSpecification.createFS(embeddedArray.get(i)));
        }
        retval = new COSArrayList<>(embedded, embeddedArray);
    }
    return retval;
}
Also used : PDFileSpecification(org.apache.pdfbox.pdmodel.common.filespecification.PDFileSpecification) COSArray(org.apache.pdfbox.cos.COSArray) COSArrayList(org.apache.pdfbox.pdmodel.common.COSArrayList) ArrayList(java.util.ArrayList)

Example 7 with PDFileSpecification

use of org.apache.pdfbox.pdmodel.common.filespecification.PDFileSpecification in project pdfbox by apache.

the class TestGotoRemoteAction method testGoto_KO_MissingD.

@Test
public void testGoto_KO_MissingD() throws Exception {
    PDActionRemoteGoTo gotoAction = new PDActionRemoteGoTo();
    gotoAction.setFile(new PDFileSpecification() {

        public COSBase getCOSObject() {
            return COSName.getPDFName("ADest");
        }

        @Override
        public void setFile(String file) {
        }

        @Override
        public String getFile() {
            return "pouey";
        }
    });
    valid(gotoAction, false, PreflightConstants.ERROR_ACTION_MISING_KEY);
}
Also used : PDFileSpecification(org.apache.pdfbox.pdmodel.common.filespecification.PDFileSpecification) COSBase(org.apache.pdfbox.cos.COSBase) PDActionRemoteGoTo(org.apache.pdfbox.pdmodel.interactive.action.PDActionRemoteGoTo) Test(org.junit.Test)

Aggregations

PDFileSpecification (org.apache.pdfbox.pdmodel.common.filespecification.PDFileSpecification)7 COSBase (org.apache.pdfbox.cos.COSBase)4 PDActionRemoteGoTo (org.apache.pdfbox.pdmodel.interactive.action.PDActionRemoteGoTo)3 Test (org.junit.Test)3 COSArray (org.apache.pdfbox.cos.COSArray)2 COSDictionary (org.apache.pdfbox.cos.COSDictionary)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 COSString (org.apache.pdfbox.cos.COSString)1 PDDocument (org.apache.pdfbox.pdmodel.PDDocument)1 PDDocumentNameDictionary (org.apache.pdfbox.pdmodel.PDDocumentNameDictionary)1 PDEmbeddedFilesNameTreeNode (org.apache.pdfbox.pdmodel.PDEmbeddedFilesNameTreeNode)1 PDPage (org.apache.pdfbox.pdmodel.PDPage)1 COSArrayList (org.apache.pdfbox.pdmodel.common.COSArrayList)1 PDNameTreeNode (org.apache.pdfbox.pdmodel.common.PDNameTreeNode)1 PDComplexFileSpecification (org.apache.pdfbox.pdmodel.common.filespecification.PDComplexFileSpecification)1 PDEmbeddedFile (org.apache.pdfbox.pdmodel.common.filespecification.PDEmbeddedFile)1 PDAnnotation (org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation)1 PDAnnotationFileAttachment (org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationFileAttachment)1