PDF (.pdf)

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 and ExportImport and 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 as specifying the corresponding .
  • 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 InterfaceNotebook 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.

ElementsElements

  • 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 element.
  • On Export, attachments are given as a list of file path specifications or rules of the form "filename"->expr, where is the name of the file attached to the PDF document, and expr is an arbitrary Wolfram Language expression. Objects that can be attached to PDF include Wolfram System notebooks, cell expressions, text, image and graphics objects.
  • 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

OptionsOptions

  • 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 :
  • 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

ExamplesExamplesopen allclose all

Basic Examples  (6)Basic Examples  (6)

This imports a simple PDF example file as graphics:

In[1]:=
Click for copyable input
Out[1]=

Show the Import elements available in this file:

In[2]:=
Click for copyable input
Out[2]=

Extract raw text from a PDF file:

In[3]:=
Click for copyable input
Out[3]=

Import three meta-information elements:

In[4]:=
Click for copyable input
Out[4]=

Export an image to PDF:

In[1]:=
Click for copyable input
Out[1]=

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

In[1]:=
Click for copyable input
Out[1]//TraditionalForm=
In[2]:=
Click for copyable input
Out[2]=

Create a PDF file with a JPEG attachment:

In[1]:=
Click for copyable input

Attach a file on your computer system to a PDF:

In[1]:=
Click for copyable input
Out[1]=

Import the resulting PDF:

In[2]:=
Click for copyable input
Out[2]=

Attach this notebook to a PDF:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2007
(6.0)
| Updated in 2014
(10.0)