Main Content

pdfinfo

PDF file information

Since R2023a

    Description

    example

    info = pdfinfo(filename) returns information stored in the specified PDF file.

    info = pdfinfo(filename,Password=password) also specifies the user or owner password to read the PDF file.

    Examples

    collapse all

    Extract the PDF information from the file exampleSonnets.pdf.

    filename = "exampleSonnets.pdf";
    info = pdfinfo(filename)
    info = struct with fields:
                    NumPages: 47
                    PageSize: [47×4 double]
                  PDFVersion: "1.6"
                       Title: ""
                     Subject: ""
                    Language: "en-GB"
                    Keywords: ""
                      Author: "William Shakespeare"
                     Creator: "Microsoft® Word 2013"
                    Producer: "Microsoft® Word 2013"
                CreationDate: 21-Jul-2017 11:53:33
            ModificationDate: 28-Sep-2022 17:30:37
                   Encrypted: 0
        AllowsTextExtraction: 1
                    Filename: "C:\TEMP\exampleSonnets.pdf"
    
    

    Input Arguments

    collapse all

    Name of the file, specified as a string scalar, character vector, or a 1-by-1 cell array containing a character vector.

    Data Types: string | char | cell

    Password to open the PDF file, specified as a character vector or a string scalar.

    Example: "skroWhtaM"

    Data Types: string | char

    Output Arguments

    collapse all

    PDF file information, returned as a structure with these fields:

    • NumPages — Number of pages

    • PageSize — Size of the pages, specified as a NumPages-by-4 array. PageSize(n,:) is the vector [left bottom width height] that corresponds to page n, where:

      • left is the distance of the left edge of the canvas to the left edge of the page in PDF points (1/72 inch)

      • bottom is the distance of the bottom edge of the canvas to the bottom edge of the page in PDF points

      • height is the height of the page in PDF points

      • width is the width of the page in PDF points

    • PDFVersion — Version of PDF file

    • Title — Title stored in PDF file metadata

    • Language — Language stored in PDF file metadata

    • Keywords — Keywords of PDF file

    • Author — Author of PDF file

    • Creator — Creator of PDF file

    • Producer — Producer of PDF file

    • CreationDate — Date and time when PDF file was created

    • ModificationDate — Date and time when PDF file was last modified

    • Encrypted — Flag indicating whether PDF file is encrypted

    • AllowsTextExtraction — Flag indicating whether PDF file allows text extraction

    • Filename — Filename of PDF file

    Version History

    Introduced in R2023a