Class PdfFileSpecification


  • public class PdfFileSpecification
    extends PdfDictionary
    Specifies a file or an URL. The file can be extern or embedded.
    • Constructor Detail

      • PdfFileSpecification

        public PdfFileSpecification()
        Creates a new instance of PdfFileSpecification. The static methods are preferred.
    • Method Detail

      • url

        public static PdfFileSpecification url​(PdfWriter writer,
                                               java.lang.String url)
        Creates a file specification of type URL.
        Parameters:
        writer - the PdfWriter
        url - the URL
        Returns:
        the file specification
      • fileEmbedded

        public static PdfFileSpecification fileEmbedded​(PdfWriter writer,
                                                        java.lang.String filePath,
                                                        java.lang.String fileDisplay,
                                                        byte[] fileStore)
                                                 throws java.io.IOException
        Creates a file specification with the file embedded. The file may come from the file system or from a byte array. The data is flate compressed.
        Parameters:
        writer - the PdfWriter
        filePath - the file path
        fileDisplay - the file information that is presented to the user
        fileStore - the byte array with the file. If it is not null it takes precedence over filePath
        Returns:
        the file specification
        Throws:
        java.io.IOException - on error
      • fileEmbedded

        public static PdfFileSpecification fileEmbedded​(PdfWriter writer,
                                                        java.lang.String filePath,
                                                        java.lang.String fileDisplay,
                                                        byte[] fileStore,
                                                        boolean compress)
                                                 throws java.io.IOException
        Creates a file specification with the file embedded. The file may come from the file system or from a byte array.
        Parameters:
        writer - the PdfWriter
        filePath - the file path
        fileDisplay - the file information that is presented to the user
        fileStore - the byte array with the file. If it is not null it takes precedence over filePath
        compress - sets the compression on the data. Multimedia content will benefit little from compression
        Returns:
        the file specification
        Throws:
        java.io.IOException - on error
      • fileExtern

        public static PdfFileSpecification fileExtern​(PdfWriter writer,
                                                      java.lang.String filePath)
        Creates a file specification for an external file.
        Parameters:
        writer - the PdfWriter
        filePath - the file path
        Returns:
        the file specification
      • getReference

        public PdfIndirectReference getReference()
                                          throws java.io.IOException
        Gets the indirect reference to this file specification. Multiple invocations will retrieve the same value.
        Returns:
        the indirect reference
        Throws:
        java.io.IOException - on error