PDF (.pdf)

Background & Context

    • MIME type: application/pdf
    • Adobe Acrobat format.
    • Standard format for exchanging and archiving multi-page documents.
    • PDF is an acronym for Portable Document Format.
    • Binary file format.
    • Stores text, fonts, images, and 2D vector graphics in a device and resolutionindependent way.
    • Can also store embedded raster images.
    • Supports multiple lossy and lossless compression methods.

Import & Export

  • Import["file.pdf"] imports a PDF file, returning all pages as a list of graphics.
  • Export["file.pdf",expr] exports any expression to PDF.
  • Import["file.pdf"] converts the pages of a PDF file to Wolfram Language vector graphics.
  • Import["file.pdf","Plaintext"] gives a plain text version of a PDF file.
  • Export["file.pdf",expr] creates a PDF file from an arbitrary expression, cell, or notebook object.
  • The Wolfram Language does not rasterize fonts or 2D vector graphics when exporting to PDF.
  • Import["file.pdf",elem] imports the specified element from a PDF file.
  • Import["file.pdf",{elem,suba,subb,}] imports a subelement.
  • Import["file.pdf",{{elem1,elem2,}}] imports multiple elements.
  • The import format can be specified with Import["file","PDF"] or Import["file",{"PDF",elem,}].
  • Export["file.pdf",expr,elem] creates a PDF file by treating expr as specifying element elem.
  • Export["file.pdf",{expr1,expr2,},{{elem1,elem2,}}] treats each expri as specifying the corresponding elemi.
  • Export["file.pdf",expr,opt1->val1,] exports expr with the specified option elements taken to have the specified values.
  • Export["file.pdf",{elem1->expr1,elem2->expr2,},"Rules"] uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
  • ImportString and ExportString support PDF.

Notebook Interface

  • In the notebook front end, Insert Picture and the Open menu allow import of a PDF file into a cell.
  • Save As exports the active notebook as a PDF file.
  • Save Selection As exports the selected part of a notebook to PDF.

Import Elements

  • General Import elements:
  • "Elements"list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties, and settings
  • Data representation elements:
  • "Pages"list of vector graphics, each representing a page of the PDF file
    "Plaintext"textual content of the document, given as a string
    "Attachments"list of attachments, imported as a Wolfram Language expression if possible
    "RawAttachments"attachments given as a list of raw strings
  • Import by default uses the "Pages" element.
  • Importing individual pages:
  • "Pages",nvector graphics, representing the n^(th) page
    "Plaintext",ntextual content of the n^(th) page
  • Meta-information elements:
  • "Author"name of person who created this document
    "CreationDate"creation date of the document, given as a DateObject
    "Creator"program that created this file
    "PageCount"number of pages
    "Title"document title


  • Import options:
  • "Password"Nonedocument password given as a string
    "TextOutlines"Truewhether to import characters as outlines
  • General Export options:
  • ImageSizeAutomaticoverall image size
    ImageResolution72image resolution for rasterization in dpi
  • Advanced Export option:
  • "AllowRasterization"Automaticwhether to rasterize a graphic that requires advanced versions of PDF
  • Possible settings for "AllowRasterization":
  • Automaticrasterize a graphic that contains features such as transparency or gradients that require advanced versions of PDF to render
    Truealways rasterize graphics
    Falsealways use vector graphics, deploying advanced PDF features where necessary for faithful rendering


Basic Examples  (3)

This imports a simple PDF example file as graphics:

Show the Import elements available in this file:

Extract raw text from a PDF file:

Import three meta-information elements:

Export an image to PDF:

Export a typeset mathematical formula to a resolution-independent PDF:

Introduced in 2007
Updated in 2014