FedoraForum.org - Fedora Support Forums and Community
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2016
    Location
    Iraq
    Posts
    770

    QPDF is SUPER excellent PDF command line utality for Linux !!! Do you know it ??

    Hi. I discover a hidden (as I think) CLI PDF tool.

    It is SUPER excellent tool, being very powerful, able to perform highly difficult & specific operations on PDF files ....... .

    With this utility + Okular + jPDF Tweak, Linux system is not poor in support for PDF manipulation at all.

    It is available in Fedora repositories.

    Here it's sites:

    http://qpdf.sourceforge.net/

    https://sourceforge.net/projects/qpdf/

    https://github.com/qpdf/qpdf

    Just look for it's manual:

    http://qpdf.sourceforge.net/files/qpdf-manual.pdf

    Please notice that NOT EVERY THINGS included in this manual. There are many very powerful abilities not included in it (look for chapters 5 "Using QPDF Library" & chapter 6 "Design & Library Notes"). These beyond my understanding after rapid reading.

    I will post here what I think the most important commands:

    To remove PDF restrictions:
    $ qpdf --decrypt infile.pdf outfile.pdf

    To remove PDF user (open) password (you should already know it):
    $ qpdf --password=userpassword --decrypt infile.pdf outfile.pdf

    To encrypt PDF file:
    $ qpdf --encrypt user-password owner-password key-length [restrictions] -- infile.pdf outfile.pdf

    Note: “--” terminates parsing of encryption flags and must be present even if no restrictions are present. Either or both of the user password and the owner password may be empty strings. The value for key-length may be 40, 128, or 256. When no additional restrictions are given, the default is to be fully permissive.
    Password-protected files may be opened by specifying a password. By default, qpdf will preserve any encryption data associated with a file. If --decrypt is specified, qpdf will attempt to remove any encryption information. If –encrypt is specified, qpdf will replace the document's encryption parameters with whatever is specified.
    Note that qpdf does not obey encryption restrictions already imposed on the file. Doing so would be meaningless since qpdf can be used to remove encryption from the file entirely.
    The restriction flags are dependent upon key length.
    If key-length is 256, the minimum PDF version is 1.7 with extension level 8, and the AES-based encryption format used is the PDF 2.0 encryption method supported by Acrobat X.

    --accessibility=[yn]
    Determines whether or not to allow accessibility to visually impaired.

    --extract=[yn]
    Determines whether or not to allow text/graphic extraction.

    --print=print-opt
    Controls printing access. print-opt may be one of the following:
    • full: allow full printing
    • low: allow low-resolution printing only
    • none: disallow printing

    --modify=modify-opt
    Controls modify access. modify-opt may be one of the following, each of which implies all the options that follow it:
    • 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
    --cleartext-metadata
    If specified, any metadata stream in the document will be left unencrypted even if the rest of the document is encrypted. This also forces the PDF version to be at least 1.5.
    --force-R5
    If specified, qpdf sets the minimum version to 1.7 at extension level 3 and writes the deprecated encryption format used by Acrobat version IX. This option should not be used in practice to generate PDF files that will be in general use, but it can be useful to generate files if you are trying to test proper support in another application for PDF files encrypted in this way.
    The default for each permission option is to be fully permissive.

    To show document encryption parameters (also shows the document's user password if the owner password is given):
    $ qpdf --show-encryption file.pdf

    To combine all pages in a set of files (merge multiple PDF files into single PDF):
    $ qpdf --empty --pages *.pdf -- output.pdf


    To extract a pages range of PDF to single PDF, with preserving their metadata:
    $ qpdf infile.pdf --pages infile.pdf 1-10 -- output.pdf

    To extract a pages range of PDF to single PDF, without their metadata:
    $ qpdf --empty --pages infile.pdf 1-10 -- output.pdf

    To take pages 1–5 from file1.pdf and pages 11–15 from file2.pdf in reverse:
    $ qpdf file1.pdf --pages file1.pdf 1-5 file2.pdf 15-11 -- outfile.pdf

    Note: the page range is a set of numbers separated by commas, ranges of numbers separated dashes, or combinations of those. The character “z” represents the last page, while the character “l” represent the first page. Pages can appear in any order. Ranges can appear with a high number followed by a low number, which causes the pages to appear in reverse. Repeating a number will cause an error.
    Example page ranges:
    • 1,3,5-9,15-12: mean pages 1, 2, 3, 5, 6, 7, 8, 9, 15, 14, 13, and 12.
    • you can specify single page only.
    • z-1: mean all pages in the document in reverse.

    To repair a PDF:
    $ qpdf infile.pdf outfile.pdf

    To linearize a pdf:
    $ qpdf --linearize infile.pdf outfile.pdf

    To remove linearization (objuct streams) from PDF:
    $ qpdf --object-streams=disable -qdf infile.pdf outfile.pdf

    ----------------------------------
    The tool is still under active development, so send your idea to the developer to be included.

    Repeatedly I asked for such tool, but no one mention it here !! Fo that I post about it now because I think that it is not well known.

    More & more my need for Windows OS programs for manipulating PDF files decreasing over time by discovery of such tools.
    Last edited by User808; 12th March 2017 at 04:14 PM.
    Fedora 26 X64 bit Cinnamon edition on Lenovo ThinkPad e550 with Intel core i7 5500 CPU @ 2.40 GH X 2, RAM = 8 GB, HHD = 1 TB, Hybrid VGA (Intel Corporation HD Graphic 5500 + Radeon R7 M265 2GB)

  2. #2
    Join Date
    Mar 2011
    Location
    /
    Posts
    5,102

    Re: QPDF is SUPER excellent PDF command line utality for Linux !!! Do you know it ??

    Nice!

    Thanks for this tip. I had no idea such a powerful program existed!
    Fedora 27 x86_64 XFCE - Sager | Intel Core i7 - 4810 MQ | NVIDIA GeForce GTX 860M | 16 GB RAM | 480 GB ADATA SSD |
    Fedora 27 x86_64 XFCE - Dell Precision M4800 | Intel Core i7 - 4900 MQ | NVIDIA Quadro K1100M | 16 GB RAM | 750 GB 7200 RPM HDD |


    The Linux Documentation Project | Fedora Documentation

  3. #3
    Join Date
    Aug 2016
    Location
    Iraq
    Posts
    770

    Re: QPDF is SUPER excellent PDF command line utality for Linux !!! Do you know it ??

    Hi. I discovered an error in manual of this great utilities ! It is related to VERY VERY VERY important function: combine (merge) multiple PDF files into single PDF. I edit my 1st post & correct nessessary command - that given wrongly in manual - & put it in RED BOLD font.

    Please notice that this golden command RE-SIZE pages of all input PDF files & set them to same universal size in the output PDF file !!! Great !!! Very strong !!!
    Fedora 26 X64 bit Cinnamon edition on Lenovo ThinkPad e550 with Intel core i7 5500 CPU @ 2.40 GH X 2, RAM = 8 GB, HHD = 1 TB, Hybrid VGA (Intel Corporation HD Graphic 5500 + Radeon R7 M265 2GB)

Similar Threads

  1. The Linux Command Line (book)
    By jonnycat in forum Links
    Replies: 2
    Last Post: 27th January 2013, 07:25 AM
  2. linux set file associations from the command line
    By COKEDUDE in forum Guides & Solutions (Not For Questions)
    Replies: 0
    Last Post: 17th January 2012, 12:52 PM
  3. convert ppt to pdf linux command line
    By sajadfedorafrum in forum Using Fedora
    Replies: 0
    Last Post: 23rd November 2010, 08:08 AM
  4. Linux command line:Bash usage of source
    By todd987345 in forum Using Fedora
    Replies: 3
    Last Post: 10th June 2010, 08:28 PM
  5. Linux: GUI vs. Command Line
    By hermouche in forum Linux Chat
    Replies: 19
    Last Post: 10th December 2008, 02:16 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •