Fedora Linux Support Community & Resources Center
  #1  
Old 9th March 2017, 09:38 AM
User808 Offline
Registered User
 
Join Date: Aug 2016
Location: Iraq
Posts: 600
linuxfedorafirefox
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.
__________________
Fedora 24 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)

Last edited by User808; 12th March 2017 at 04:14 PM.
Reply With Quote
  #2  
Old 9th March 2017, 01:15 PM
nonamedotc Offline
Mithrandir
 
Join Date: Mar 2011
Location: /
Posts: 4,976
windows_7chrome
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 24 x86_64 XFCE - Sager | Intel Core i7 - 4810 MQ | NVIDIA GeForce GTX 860M | 16 GB RAM | 480 GB ADATA SSD |
CentOS 7.2.1511 x86_64 Server - Thinkpad T520 | Intel Core i7 - 2630 QM | NVIDIA NVS 4200M | 16 GB RAM | 500 GB 7200 RPM HDD |


The Linux Documentation Project | Fedora Documentation
Reply With Quote
  #3  
Old 12th March 2017, 04:13 PM
User808 Offline
Registered User
 
Join Date: Aug 2016
Location: Iraq
Posts: 600
linuxfedorafirefox
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 24 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)
Reply With Quote
Reply

Tags
command, excellent, line, linux, pdf, qpdf, super, utality

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


Current GMT-time: 18:41 (Monday, 24-07-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat