com.aspose.pdf.facades

Class PdfFileInfo

  • All Implemented Interfaces:
    com.aspose.ms.System.IDisposable, IFacade, ISaveableFacade


    public final class PdfFileInfo
    extends SaveableFacade

    Represents a class for accessing meta information of PDF document.

    • Constructor Detail

      • PdfFileInfo

        public PdfFileInfo()

        Initializes a new instance of the com.aspose.pdf.facades.PdfFileInfo class with default values.

      • PdfFileInfo

        public PdfFileInfo(InputStream inputStream)

        Initializes a new instance of the com.aspose.pdf.facades.PdfFileInfo class.

        Parameters:
        inputStream - Stream where input file is placed.
      • PdfFileInfo

        public PdfFileInfo(InputStream inputStream,
                           String password)

        Initializes a new instance of the com.aspose.pdf.facades.PdfFileInfo class.

        Parameters:
        inputStream - Stream where input file is placed.
        password - Password for access to file.
      • PdfFileInfo

        public PdfFileInfo(String inputFile)

        Initializes a new instance of the com.aspose.pdf.facades.PdfFileInfo class.

        Parameters:
        inputFile - Name of file containing input file.
      • PdfFileInfo

        public PdfFileInfo(String inputFile,
                           String password)

        Initializes a new instance of the com.aspose.pdf.facades.PdfFileInfo class.

        Parameters:
        inputFile - Name of file containing input file.
        password - Password for access to file.
      • PdfFileInfo

        public PdfFileInfo(IDocument document)

        Initializes new PdfFileInfo object on base of the document.

        Parameters:
        document - Pdf document.
    • Method Detail

      • bindPdf

        public void bindPdf(String srcFile,
                            String password)

        Initializes the facade.

        Overrides:
        bindPdf in class Facade
        Parameters:
        srcFile - The PDF file.
        password - The password of the PDF document.
      • bindPdf

        public void bindPdf(Document srcDoc)

        Initializes the facade.

        Parameters:
        srcDoc - The Aspose.Pdf.Document object.
      • getAuthor

        public String getAuthor()

        Gets the Author information of PDF document.

        Returns:
        String value
      • setAuthor

        public void setAuthor(String value)

        Sets the Author information of PDF document.

        Parameters:
        value - String value
      • isEncrypted

        public boolean isEncrypted()

        Checkes whether the PDF document is encrypted.

        Returns:
        boolean value
      • isPdfFile

        public boolean isPdfFile()

        Checkes whether the source input is a valid PDF file.

        Returns:
        boolean value
      • getCreationDate

        public String getCreationDate()

        Gets the CreationDate information of PDF document.

        Returns:
        String value
      • setCreationDate

        public void setCreationDate(String value)

        Sets the CreationDate information of PDF document.

        Parameters:
        value - String value
      • getCreator

        public String getCreator()

        Gets the Creator information of PDF document.

        Returns:
        String value
      • setCreator

        public void setCreator(String value)

        Sets the Creator information of PDF document.

        Parameters:
        value - String value
      • hasCollection

        public boolean hasCollection()

        Returns true if the current input file is a 'Portfolio' file containing collection of PDF files in it.

        Returns:
        boolean value
      • getHeader

        public Map<String,String> getHeader()

        Gets the customized information of PDF document.

        Returns:
        Map<String, String> object
      • setHeader

        public void setHeader(Map<String,String> value)

        Sets the customized information of PDF document.

        Parameters:
        value - Map<String, String> object
      • getInputFile

        @Deprecated
        public String getInputFile()
        Deprecated. 

        Gets the input file.

        Returns:
        String value
      • setInputFile

        @Deprecated
        public void setInputFile(String value)
        Deprecated. 

        Sets the input file.

        Parameters:
        value - String value
      • getInputStream

        @Deprecated
        public InputStream getInputStream()
        Deprecated. 

        Gets the input stream.

        Returns:
        InputStream object
      • setInputStream

        @Deprecated
        public void setInputStream(InputStream value)
        Deprecated. 

        Sets the input stream.

        Parameters:
        value - InputStream object
      • getKeywords

        public String getKeywords()

        Gets the Keywords information of PDF document.

        Returns:
        String value
      • setKeywords

        public void setKeywords(String value)

        Sets the Keywords information of PDF document.

        Parameters:
        value - String value
      • getModDate

        public String getModDate()

        Gets the ModDate date information of PDF document.

        Returns:
        String value
      • setModDate

        public void setModDate(String value)

        Sets the ModDate date information of PDF document.

        Parameters:
        value - String value
      • getNumberOfPages

        public int getNumberOfPages()

        Gets the number of document pages.

        Returns:
        int value
      • getProducer

        public String getProducer()

        Gets the Producer information of PDF document.

        Returns:
        String value
      • getSubject

        public String getSubject()

        Gets the Subject information of PDF document.

        Returns:
        String value
      • setSubject

        public void setSubject(String value)

        Sets the Subject information of PDF document.

        Parameters:
        value - String value
      • getTitle

        public String getTitle()

        Gets the Title information of PDF document.

        Returns:
        String value
      • setTitle

        public void setTitle(String value)

        Sets the Title information of PDF document.

        Parameters:
        value - String value
      • clearInfo

        public void clearInfo()

        Clears all meta information of PDF document.

      • getDocumentPrivilege

        public DocumentPrivilege getDocumentPrivilege()

        Gets the PDF document privilege settings.

        Returns:
        The PDF document privilege settings.
      • getMetaInfo

        public String getMetaInfo(String name)

        Gets customized information of PDF document with property name. If there is no property match the name it will return a blank string.

        Parameters:
        name - Custom meta property key.
        Returns:
        Custom meta property value.
      • getPageHeight

        public float getPageHeight(int pageNum)

        Gets the height of the specified page.

        Parameters:
        pageNum - Page number.
        Returns:
        The height of the page.
      • getPageRotation

        public int getPageRotation(int pageNum)

        Gets the rotation of the specified page.

        Parameters:
        pageNum - Page number.
        Returns:
        The rotation of the page. The value may be 0,90,180,270.
      • getPageWidth

        public float getPageWidth(int pageNum)

        Gets the width of the specified page.

        Parameters:
        pageNum - Page number.
        Returns:
        The width of the page.
      • getPageXOffset

        public float getPageXOffset(int pageNum)

        Gets the horizontal offset of the specified page display area.

        Parameters:
        pageNum - Page number.
        Returns:
        The horizontal offset from the left side of the page.
      • getPageYOffset

        public float getPageYOffset(int pageNum)

        Gets the vertical offset of the specified page display area.

        Parameters:
        pageNum - Page number.
        Returns:
        The vertical offset of the page display area.
      • getPdfVersion

        public String getPdfVersion()

        Gets the version info of PDF document.

        Returns:
        The version string.
      • saveNewInfo

        @Deprecated
        public boolean saveNewInfo(OutputStream outputStream)
        Deprecated. 

        Save updated PDF document into specified stream.

        Parameters:
        outputStream - Output stream.
        Returns:
        True if success otherwise is false.
      • saveNewInfo

        public boolean saveNewInfo(String outputFile)

        Save updated PDF document into specified file.

        Parameters:
        outputFile - Output file.
        Returns:
        True if success otherwise is false.
      • setMetaInfo

        public void setMetaInfo(String name,
                                String value)

        Sets customized information of PDF document.

        Parameters:
        name - Custom meta property key.
        value - Custom meta property value.
      • saveNewInfoWithXmp

        public boolean saveNewInfoWithXmp(String outputFileName)

        Changes the properties specified explicitly by setting file information, other properties remain.

        Parameters:
        outputFileName - Output file.
        Returns:
        True for success, or false.
      • getPasswordType

        public int getPasswordType()

        Returns the type of password which was passed for creating PdfFileInfo instance. See possible values in PasswordType. Pay attention that pdf document can be opened using both user (or open) password and owner (or permissions, edit) password.

        Returns:
        PasswordType element
        See Also:
        PasswordType
      • hasOpenPassword

        public boolean hasOpenPassword()

        Returns true if password is needed to open password protected pdf document.

        Returns:
        boolean value
      • hasEditPassword

        public boolean hasEditPassword()

        Returns true if password is needed to modify permissions or document security property. Pay attention that this property can be read only if valid password was provided in PdfFileInfo constructor. In case PasswordType is Inaccessible (means that invalid password was provided) reading this property will fail with InvalidPasswordException.

        Returns:
        boolean value
      • close

        public void close()

        Deinitializes the instance.

        Specified by:
        close in interface IFacade
        Overrides:
        close in class Facade
      • dispose

        public void dispose()

        Deinitializes the instance.

        Specified by:
        dispose in interface com.aspose.ms.System.IDisposable
        Overrides:
        dispose in class Facade