Class PdfFileSpec

    • Constructor Detail

      • PdfFileSpec

        protected PdfFileSpec​(PdfObject pdfObject)
    • Method Detail

      • wrapFileSpecObject

        public static PdfFileSpec wrapFileSpecObject​(PdfObject fileSpecObject)
        Wrap the passed PdfObject to the specific PdfFileSpec object, according to the type of the passed pdf object.
        Parameters:
        fileSpecObject - object to wrap
        Returns:
        wrapped PdfFileSpec instance
      • createExternalFileSpec

        public static PdfFileSpec createExternalFileSpec​(PdfDocument doc,
                                                         java.lang.String filePath,
                                                         PdfName afRelationshipValue)
        Create an external file specification.
        Parameters:
        doc - PdfDocument instance to make this file specification indirect
        filePath - file specification string, describing the path to the external file
        afRelationshipValue - value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. If null, PdfName.Unspecified will be added.
        Returns:
        PdfFileSpec containing the file specification of the file
      • createExternalFileSpec

        public static PdfFileSpec createExternalFileSpec​(PdfDocument doc,
                                                         java.lang.String filePath)
        Create an external file specification.
        Parameters:
        doc - PdfDocument instance to make this file specification indirect
        filePath - file specification string, describing the path to the external file
        Returns:
        PdfFileSpec containing the file specification of the file
      • createEmbeddedFileSpec

        public static PdfFileSpec createEmbeddedFileSpec​(PdfDocument doc,
                                                         byte[] fileStore,
                                                         java.lang.String description,
                                                         java.lang.String fileDisplay,
                                                         PdfName mimeType,
                                                         PdfDictionary fileParameter,
                                                         PdfName afRelationshipValue)
        Create an embedded file specification.
        Parameters:
        doc - PdfDocument instance to make this file specification indirect
        fileStore - byte[] containing the file
        description - file description
        fileDisplay - actual file name stored in the pdf
        mimeType - subtype of the embedded file. The value of this entry shall conform to the MIME media type names
        fileParameter - PdfDictionary containing fil parameters
        afRelationshipValue - value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. If null, PdfName.Unspecified will be added.
        Returns:
        PdfFileSpec containing the file specification of the file
      • createEmbeddedFileSpec

        public static PdfFileSpec createEmbeddedFileSpec​(PdfDocument doc,
                                                         byte[] fileStore,
                                                         java.lang.String description,
                                                         java.lang.String fileDisplay,
                                                         PdfDictionary fileParameter,
                                                         PdfName afRelationshipValue)
        Create an embedded file specification.
        Parameters:
        doc - PdfDocument instance to make this file specification indirect
        fileStore - byte[] containing the file
        fileDisplay - actual file name stored in the pdf
        fileParameter - PdfDictionary containing fil parameters
        afRelationshipValue - value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. If null, PdfName.Unspecified will be added.
        description - the file description
        Returns:
        PdfFileSpec containing the file specification of the file
      • createEmbeddedFileSpec

        public static PdfFileSpec createEmbeddedFileSpec​(PdfDocument doc,
                                                         byte[] fileStore,
                                                         java.lang.String fileDisplay,
                                                         PdfDictionary fileParameter,
                                                         PdfName afRelationshipValue)
        Create an embedded file specification.
        Parameters:
        doc - PdfDocument instance to make this file specification indirect
        fileStore - byte[] containing the file
        fileDisplay - actual file name stored in the pdf
        fileParameter - PdfDictionary containing fil parameters
        afRelationshipValue - value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. If null, PdfName.Unspecified will be added.
        Returns:
        PdfFileSpec containing the file specification of the file
      • createEmbeddedFileSpec

        public static PdfFileSpec createEmbeddedFileSpec​(PdfDocument doc,
                                                         byte[] fileStore,
                                                         java.lang.String fileDisplay,
                                                         PdfName afRelationshipValue)
        Create an embedded file specification.
        Parameters:
        doc - PdfDocument instance to make this file specification indirect
        fileStore - byte[] containing the file
        fileDisplay - actual file name stored in the pdf
        afRelationshipValue - value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. If null, PdfName.Unspecified will be added.
        Returns:
        PdfFileSpec containing the file specification of the file
      • createEmbeddedFileSpec

        public static PdfFileSpec createEmbeddedFileSpec​(PdfDocument doc,
                                                         byte[] fileStore,
                                                         java.lang.String description,
                                                         java.lang.String fileDisplay,
                                                         PdfName afRelationshipValue)
        Create an embedded file specification.
        Parameters:
        doc - PdfDocument instance to make this file specification indirect
        fileStore - byte[] containing the file
        description - file description
        fileDisplay - actual file name stored in the pdf
        afRelationshipValue - value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. If null, PdfName.Unspecified will be added.
        Returns:
        PdfFileSpec containing the file specification of the file
      • createEmbeddedFileSpec

        public static PdfFileSpec createEmbeddedFileSpec​(PdfDocument doc,
                                                         java.lang.String filePath,
                                                         java.lang.String description,
                                                         java.lang.String fileDisplay,
                                                         PdfName mimeType,
                                                         PdfDictionary fileParameter,
                                                         PdfName afRelationshipValue)
                                                  throws java.io.IOException
        Create an embedded file specification.
        Parameters:
        doc - PdfDocument instance to make this file specification indirect
        filePath - file specification string, describing the path to the file to embed
        description - file description
        fileDisplay - actual file name stored in the pdf
        mimeType - subtype of the embedded file. The value of this entry shall conform to the MIME media type names
        fileParameter - dictionary with file parameters
        afRelationshipValue - value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. If null, PdfName.Unspecified will be added.
        Returns:
        PdfFileSpec containing the file specification of the file
        Throws:
        java.io.IOException - if there are errors while creating an URL from the passed file path.
      • createEmbeddedFileSpec

        public static PdfFileSpec createEmbeddedFileSpec​(PdfDocument doc,
                                                         java.lang.String filePath,
                                                         java.lang.String description,
                                                         java.lang.String fileDisplay,
                                                         PdfName mimeType,
                                                         PdfName afRelationshipValue)
                                                  throws java.io.IOException
        Create an embedded file specification.
        Parameters:
        doc - PdfDocument instance to make this file specification indirect
        filePath - file specification string, describing the path to the file to embed
        description - file description
        fileDisplay - actual file name stored in the pdf
        mimeType - subtype of the embedded file. The value of this entry shall conform to the MIME media type names
        afRelationshipValue - value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. If null, PdfName.Unspecified will be added.
        Returns:
        PdfFileSpec containing the file specification of the file
        Throws:
        java.io.IOException - if there are errors while creating an URL from the passed file path.
      • createEmbeddedFileSpec

        public static PdfFileSpec createEmbeddedFileSpec​(PdfDocument doc,
                                                         java.lang.String filePath,
                                                         java.lang.String description,
                                                         java.lang.String fileDisplay,
                                                         PdfName afRelationshipValue)
                                                  throws java.io.IOException
        Create an embedded file specification.
        Parameters:
        doc - PdfDocument instance to make this file specification indirect
        filePath - file specification string, describing the path to the file to embed
        description - file description
        fileDisplay - actual file name stored in the pdf
        afRelationshipValue - value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. If null, PdfName.Unspecified will be added.
        Returns:
        PdfFileSpec containing the file specification of the file
        Throws:
        java.io.IOException - if there are errors while creating an URL from the passed file path.
      • createEmbeddedFileSpec

        public static PdfFileSpec createEmbeddedFileSpec​(PdfDocument doc,
                                                         java.lang.String filePath,
                                                         java.lang.String fileDisplay,
                                                         PdfName afRelationshipValue)
                                                  throws java.io.IOException
        Create an embedded file specification.
        Parameters:
        doc - PdfDocument instance to make this file specification indirect
        filePath - path to the file to embed
        fileDisplay - actual file name stored in the pdf
        afRelationshipValue - value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. If null, PdfName.Unspecified will be added.
        Returns:
        PdfFileSpec containing the file specification of the file
        Throws:
        java.io.IOException - if there are errors while creating an URL from the passed file path.
      • createEmbeddedFileSpec

        public static PdfFileSpec createEmbeddedFileSpec​(PdfDocument doc,
                                                         java.io.InputStream is,
                                                         java.lang.String description,
                                                         java.lang.String fileDisplay,
                                                         PdfName mimeType,
                                                         PdfDictionary fileParameter,
                                                         PdfName afRelationshipValue)
        Create an embedded file specification.
        Parameters:
        doc - PdfDocument instance to make this file specification indirect
        is - stream containing the file to embed
        description - file description
        fileDisplay - actual file name stored in the pdf
        mimeType - subtype of the embedded file. The value of this entry shall conform to the MIME media type names
        fileParameter - dictionary with file parameters
        afRelationshipValue - value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. If null, PdfName.Unspecified will be added.
        Returns:
        PdfFileSpec containing the file specification of the file
      • createEmbeddedFileSpec

        public static PdfFileSpec createEmbeddedFileSpec​(PdfDocument doc,
                                                         java.io.InputStream is,
                                                         java.lang.String description,
                                                         java.lang.String fileDisplay,
                                                         PdfName mimeType,
                                                         PdfName afRelationshipValue)
        Create an embedded file specification.
        Parameters:
        doc - PdfDocument instance to make this file specification indirect
        is - stream containing the file to embed
        description - file description
        fileDisplay - actual file name stored in the pdf
        mimeType - subtype of the embedded file. The value of this entry shall conform to the MIME media type names
        afRelationshipValue - value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. If null, PdfName.Unspecified will be added.
        Returns:
        PdfFileSpec containing the file specification of the file
      • createEmbeddedFileSpec

        private static PdfFileSpec createEmbeddedFileSpec​(PdfDocument doc,
                                                          PdfStream stream,
                                                          java.lang.String description,
                                                          java.lang.String fileDisplay,
                                                          PdfName mimeType,
                                                          PdfName afRelationshipValue)
        Create an embedded file specification.
        Parameters:
        doc - PdfDocument instance to make this file specification indirect
        stream - an embedded file stream dictionary
        description - file description
        fileDisplay - actual file name stored in the pdf
        mimeType - subtype of the embedded file. The value of this entry shall conform to the MIME media type names
        afRelationshipValue - value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. If null, PdfName.Unspecified will be added.
        Returns:
        PdfFileSpec containing the file specification of the file
      • createEmbeddedFileSpec

        private static PdfFileSpec createEmbeddedFileSpec​(PdfDocument doc,
                                                          PdfStream stream,
                                                          java.lang.String description,
                                                          java.lang.String fileDisplay,
                                                          PdfName afRelationshipValue)
        Create an embedded file specification.
        Parameters:
        doc - PdfDocument instance to make this file specification indirect
        stream - an embedded file stream dictionary
        fileDisplay - actual file name stored in the pdf
        afRelationshipValue - value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. If null, PdfName.Unspecified will be added.
        Returns:
        PdfFileSpec containing the file specification of the file
      • getFileIdentifier

        public PdfArray getFileIdentifier()
      • setThumbnailImage

        public PdfFileSpec setThumbnailImage​(PdfImageXObject thumbnailImage)
        PDF 2.0. Sets a stream object defining the thumbnail image for the file specification.
        Parameters:
        thumbnailImage - image used as a thumbnail
        Returns:
        this PdfFileSpec instance
      • getThumbnailImage

        public PdfImageXObject getThumbnailImage()
        PDF 2.0. Gets a stream object defining the thumbnail image for the file specification.
        Returns:
        image used as a thumbnail, or null if it is not set
      • isWrappedObjectMustBeIndirect

        protected boolean isWrappedObjectMustBeIndirect()
        Description copied from class: PdfObjectWrapper
        Defines if the object behind this wrapper must be an indirect object in the resultant document.

        If this method returns true it doesn't necessarily mean that object must be in the indirect state at any moment, but rather defines that when the object will be written to the document it will be transformed into indirect object if it's not indirect yet.

        Return value of this method shouldn't depend on any logic, it should return always true or false.
        Specified by:
        isWrappedObjectMustBeIndirect in class PdfObjectWrapper<PdfObject>
        Returns:
        true if in the resultant document the object behind the wrapper must be indirect, otherwise false.