Qpdf Manual


From Docunext Technology Wiki

Jump to: navigation, search
Usage: qpdf [ options ] infilename outfilename

An option summary appears below.  Please see the documentation for details.


Basic Options
-------------

--password=password     specify a password for accessing encrypted files
--linearize             generated a linearized (web optimized) file
--encrypt options --    generate an encrypted file
--decrypt               remove any encryption on the file

If neither --encrypt or --decrypt are given, qpdf will preserve any
encryption data associated with a file.


Encryption Options
------------------

  --encrypt user-password owner-password key-length flags --

Note that -- terminates parsing of encryption flags.

Either or both of the user password and the owner password may be
empty strings.

key-length may be 40 or 128

Additional flags are dependent upon key length.

  If 40:

    --print=[yn]             allow printing
    --modify=[yn]            allow document modification
    --extract=[yn]           allow text/graphic extraction
    --annotate=[yn]          allow comments and form fill-in and signing

  If 128:

    --accessibility=[yn]     allow accessibility to visually impaired
    --extract=[yn]           allow other text/graphic extraction
    --print=print-opt        control printing access
    --modify=modify-opt      control modify access
    --cleartext-metadata     prevents encryption of metadata
    --use-aes=[yn]           indicates whether to use AES encryption
    --force-V4               forces use of V=4 encryption handler

    print-opt may be:

      full                  allow full printing
      low                   allow only low-resolution printing
      none                  disallow printing

    modify-opt may be:

      all                   allow full document modification
      annotate              allow comment authoring and form operations
      form                  allow form field fill-in and signing
      assembly              allow document assembly only
      none                  allow no modifications

The default for each permission option is to be fully permissive.

Specifying cleartext-metadata forces the PDF version to at least 1.5.
Specifying use of AES forces the PDF version to at least 1.6.  These
options are both off by default.

The --force-V4 flag forces the V=4 encryption handler introduced in PDF 1.5
to be used even if not otherwise needed.  This option is primarily useful
for testing qpdf and has no other practical use.


Advanced Transformation Options
-------------------------------

These transformation options control fine points of how qpdf creates
the output file.  Mostly these are of use only to people who are very
familiar with the PDF file format or who are PDF developers.

--stream-data=option      controls transformation of stream data (below)
--normalize-content=[yn]  enables or disables normalization of content streams
--suppress-recovery       prevents qpdf from attempting to recover damaged files
--object-streams=mode     controls handing of object streams
--ignore-xref-streams     tells qpdf to ignore any cross-reference streams
--qdf                     turns on "QDF mode" (below)
--min-version=version     sets the minimum PDF version of the output file
--force-version=version   forces this to be the PDF version of the output file

Values for stream data options:

  compress              recompress stream data when possible (default)
  preserve              leave all stream data as is
  uncompress            uncompress stream data when possible

Values for object stream mode:

  preserve                  preserve original object streams (default)
  disable                   don't write any object streams
  generate                  use object streams wherever possible

In qdf mode, by default, content normalization is turned on, and the
stream data mode is set to uncompress.

Setting the minimum PDF version of the output file may raise the version
but will never lower it.  Forcing the PDF version of the output file may
set the PDF version to a lower value than actually allowed by the file's
contents.  You should only do this if you have no other possible way to
open the file or if you know that the file definitely doesn't include
features not supported later versions.

Testing, Inspection, and Debugging Options
------------------------------------------

These options can be useful for digging into PDF files or for use in
automated test suites for software that uses the qpdf library.

--static-id               generate static /ID: FOR TESTING ONLY!
--static-aes-iv           use a static initialization vector for AES-CBC
                          This is option is not secure!  FOR TESTING ONLY!
--no-original-object-ids  suppress original object ID comments in qdf mode
--show-encryption         quickly show encryption parameters
--check-linearization     check file integrity and linearization status
--show-linearization      check and show all linearization data
--show-xref               show the contents of the cross-reference table
--show-object=obj[,gen]   show the contents of the given object
  --raw-stream-data       show raw stream data instead of object contents
  --filtered-stream-data  show filtered stream data instead of object contents
--show-pages              shows the object/generation number for each page
  --with-images           also shows the object IDs for images on each page
--check                   check file structure + encryption, linearization

The --raw-stream-data and --filtered-stream-data options are ignored
unless --show-object is given.  Either of these options will cause the
stream data to be written to standard output.

If --filtered-stream-data is given and --normalize-content=y is also
given, qpdf will attempt to normalize the stream data as if it is a
page content stream.  This attempt will be made even if it is not a
page content stream, in which case it will produce unusable results.

Ordinarily, qpdf exits with a status of 0 on success or a status of 2
if any errors occurred.  In --check mode, if there were warnings but not
errors, qpdf exits with a status of 3.

Related Pages

Personal tools