<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://aznot.com/index.php?action=history&amp;feed=atom&amp;title=Linux%2FPDF</id>
	<title>Linux/PDF - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://aznot.com/index.php?action=history&amp;feed=atom&amp;title=Linux%2FPDF"/>
	<link rel="alternate" type="text/html" href="https://aznot.com/index.php?title=Linux/PDF&amp;action=history"/>
	<updated>2026-05-07T03:46:28Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://aznot.com/index.php?title=Linux/PDF&amp;diff=4578&amp;oldid=prev</id>
		<title>Kenneth: /* Remove Page */</title>
		<link rel="alternate" type="text/html" href="https://aznot.com/index.php?title=Linux/PDF&amp;diff=4578&amp;oldid=prev"/>
		<updated>2018-01-22T04:41:32Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Remove Page&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== pdftk is better than ghostscript ==&lt;br /&gt;
&lt;br /&gt;
Use pdftk!&lt;br /&gt;
&lt;br /&gt;
== Merge PDFs ==&lt;br /&gt;
&lt;br /&gt;
Merge multiple PDFs with GhostScript: [http://superuser.com/questions/54041/how-to-merge-pdfs-using-imagemagick-resolution-problem] [https://nixtricks.wordpress.com/2009/09/01/cli-combine-or-remove-pages-from-a-pdf-document-using-ghostscript/]&lt;br /&gt;
 gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=temp.pdf pdf1.pdf pdf2.pdf&lt;br /&gt;
&lt;br /&gt;
Merge multiple PDFs with pdftk: [http://superuser.com/questions/54041/how-to-merge-pdfs-using-imagemagick-resolution-problem]&lt;br /&gt;
 # must install first&lt;br /&gt;
 pdftk pdf1.pdf pdf2.pdf cat output temp.pdf&lt;br /&gt;
&lt;br /&gt;
Merge multiple PDFs with ImageMagick: [http://superuser.com/questions/54041/how-to-merge-pdfs-using-imagemagick-resolution-problem]&lt;br /&gt;
 convert -density 150 $(ls -rt *pdf) output.pdf&lt;br /&gt;
 convert -density 150 *.pdf output.pdf&lt;br /&gt;
 convert -density 600 file1.pdf file2.pdf -resize 50% new.pdf&lt;br /&gt;
&lt;br /&gt;
== Remove Page ==&lt;br /&gt;
&lt;br /&gt;
Remove a page with GhostScript:&lt;br /&gt;
 # print pages from [START_PAGE] to [END_PAGE]&lt;br /&gt;
 gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dQUIET -dFirstPage=[START_PAGE] -dLastPage=[END_PAGE] -sOutputFile=output.pdf input.pdf&lt;br /&gt;
&lt;br /&gt;
For reasons outlined by KenS, Ghostscript is not the best tool for what you want to achieve. A better tool for this task is pdftk [http://stackoverflow.com/questions/22871712/use-ghostscript-to-delete-a-page-not-extracting-a-range]&lt;br /&gt;
 # print pages 1, and 3-end (3 to end)&lt;br /&gt;
 pdftk  input.pdf  cat 1 3-end  output output.pdf&lt;br /&gt;
&lt;br /&gt;
== Remove Secure ==&lt;br /&gt;
&lt;br /&gt;
If signed (secure), this can be removed with qpdf:&lt;br /&gt;
&lt;br /&gt;
 qpdf --decrypt in.pdf out.pdf&lt;br /&gt;
&lt;br /&gt;
 yum install qpdf&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Assuming it&amp;#039;s simply a &amp;#039;rights&amp;#039; (owner) password that restricts things like editing, printing, and copying (i.e. the password does not need to be entered to open the file) the following will remove the restrictions:&lt;br /&gt;
&lt;br /&gt;
#    Grab http://qpdf.sourceforge.net/&lt;br /&gt;
#    Unzip/Install and navigate to the bin folder that holds qpdf.exe (or similar for your platform)&lt;br /&gt;
#    Place the PDF you wish to work on in the same folder&lt;br /&gt;
#    Run: qpdf --decrypt InputFile.pdf OutputFile.pdf (use &amp;quot;s if the file name has spaces).&lt;br /&gt;
#    Do what you like with the OutputFile.&lt;br /&gt;
&lt;br /&gt;
If your PDF file is user password protected, change step 4 to qpdf --decrypt --password=yourpassword InputFile OutputFile&lt;br /&gt;
&lt;br /&gt;
ref: https://superuser.com/questions/179064/how-to-remove-security-from-a-pdf-file&lt;br /&gt;
&lt;br /&gt;
This won&amp;#039;t work for Adobe Digital Editions and may have issues with digitally-signed files.&lt;br /&gt;
&lt;br /&gt;
Some discussion on the background of these owner password restrictions at https://lwn.net/Articles/335415/&lt;br /&gt;
&lt;br /&gt;
== Select Pages and Merge ==&lt;br /&gt;
&lt;br /&gt;
 # copy pages 55 60-end to new file&lt;br /&gt;
 pdftk book1.pdf cat 55 60-end output book1_small.pdf&lt;br /&gt;
&lt;br /&gt;
 # copy last page to new file&lt;br /&gt;
 pdftk book2.pdf cat end output book2_small.pdf&lt;br /&gt;
&lt;br /&gt;
 # merge files&lt;br /&gt;
 pdftk book1_small.pdf book2_small.pdf cat output book_combined.pdf&lt;br /&gt;
&lt;br /&gt;
== Linux PDF ==&lt;br /&gt;
&lt;br /&gt;
Install:&lt;br /&gt;
 yum install ghostscript poppler-utils pdftk ImageMagick&lt;br /&gt;
&lt;br /&gt;
-&lt;br /&gt;
&lt;br /&gt;
== Convert JPEG to PDF ==&lt;br /&gt;
&lt;br /&gt;
Convert JPGs to PDF: (using ImageMagick) [http://askubuntu.com/questions/246647/jpeg-files-to-pdf] [http://unix.stackexchange.com/questions/20026/convert-images-to-pdf-how-to-make-pdf-pages-same-size]&lt;br /&gt;
 convert *.jpg pictures.pdf&lt;br /&gt;
 convert page1.jpg page2.jpg +compress file.pdf&lt;br /&gt;
 convert `ls -1v` file.pdf&lt;br /&gt;
 convert -page A4 -compress A4 *.png CH00.pdf&lt;br /&gt;
 convert a.png b.png -compress jpeg -resize 1240x1753 -units PixelsPerInch -density 150x150 multipage.pdf&lt;br /&gt;
&lt;br /&gt;
 convert a.png b.png -compress jpeg -resize 1240x1753 \&lt;br /&gt;
                      -extent 1240x1753 -gravity center \&lt;br /&gt;
                      -units PixelsPerInch -density 150x150 multipage.pdf&lt;br /&gt;
&lt;br /&gt;
 convert in.jpg -resize 1240x1750 -background black -compose Copy\&lt;br /&gt;
               -gravity center -extent 1240x1750\&lt;br /&gt;
               -units PixelsPerInch -density 150 out.pdf&lt;br /&gt;
&lt;br /&gt;
 convert in.jpg -units PixelsPerInch -set density &amp;#039;%[fx:w/8.27]&amp;#039;\&lt;br /&gt;
               -repage a4 out.pdf&lt;br /&gt;
&lt;br /&gt;
Set density attributes (but does not reduce actual image sizes!)&lt;br /&gt;
 convert -page 2400x2400 -density 300 *.jpg out.pdf   # 8in x 8in @ 300dpi&lt;br /&gt;
 convert -page 3375x2625 -density 300 *.jpg out.pdf   # 11.25in x 8.75in @ 300dpi&lt;br /&gt;
&lt;br /&gt;
Reduce image quality and set density attribute:&lt;br /&gt;
 convert -resize 400x400 -page 400x400 -density 100 *.jpg out2.pdf  # 4in x 4in @ 100dpi (low res 8x8)&lt;br /&gt;
 convert -resize 675x525 -page 675x525 -density 100 *.jpg out2.pdf  # 6.75in x 5.25in @ 100dpi (low res 11.25x8.75)&lt;br /&gt;
&lt;br /&gt;
== Convert PostScript to PDF ==&lt;br /&gt;
&lt;br /&gt;
 #ps2pdf links to ps2pdf12&lt;br /&gt;
 ps2pdf input.ps &lt;br /&gt;
 ps2pdf input.ps output.ps&lt;br /&gt;
 ps2pdf12 input.ps output.ps&lt;br /&gt;
 ps2pdf13 input.ps output.ps&lt;br /&gt;
 ps2pdf14 input.ps output.ps&lt;br /&gt;
&lt;br /&gt;
== Optimize PDF ==&lt;br /&gt;
&lt;br /&gt;
 pdfopt input.pdf output.pdf&lt;br /&gt;
&lt;br /&gt;
== Standard Thirteen PDF Fonts ==&lt;br /&gt;
&lt;br /&gt;
Standard Thirteen PDF Fonts (generally don&amp;#039;t embed) [http://www.linux-mag.com/id/1983]&lt;br /&gt;
 *Symbol&lt;br /&gt;
 *Times (plus four variants)&lt;br /&gt;
 *Helvetica (plus four variants)&lt;br /&gt;
 *Courier (plus four variants)&lt;br /&gt;
&lt;br /&gt;
=== List Fonts in PDF ===&lt;br /&gt;
 pdffonts input.pdf&lt;br /&gt;
&lt;br /&gt;
References:&lt;br /&gt;
[http://www.linux-mag.com/id/1983 Creating PDFs]&lt;br /&gt;
&lt;br /&gt;
== Merge multiple PDFs ==&lt;br /&gt;
&lt;br /&gt;
 yum install pdfmerge  # rpmforge&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
 Syntax:  pdfmerge file1.pdf file2.pdf... fileN.pdf outfile.pdf&lt;br /&gt;
&lt;br /&gt;
Has some issues: [http://lists.centos.org/pipermail/centos/2012-February/123135.html]&lt;br /&gt;
&lt;br /&gt;
== pdftk ==&lt;br /&gt;
&lt;br /&gt;
BEST OPTION!&lt;br /&gt;
&lt;br /&gt;
pdftk - PDF Tool Kit&lt;br /&gt;
&lt;br /&gt;
Better Merge&lt;br /&gt;
 pdftk in1.pdf in2.pdf cat output out1.pdf&lt;br /&gt;
&lt;br /&gt;
pdftk description:&lt;br /&gt;
 If PDF is electronic paper, then pdftk is an electronic&lt;br /&gt;
           : staple-remover, hole-punch, binder, secret-decoder-ring, and&lt;br /&gt;
           : X-Ray-glasses. Pdftk is a simple tool for doing everyday things&lt;br /&gt;
           : with PDF documents. Keep one in the top drawer of your desktop and&lt;br /&gt;
           : use it to:&lt;br /&gt;
           :&lt;br /&gt;
           :     * Merge PDF Documents&lt;br /&gt;
           :     * Split PDF Pages into a New Document&lt;br /&gt;
           :     * Decrypt Input as Necessary (Password Required)&lt;br /&gt;
           :     * Encrypt Output as Desired&lt;br /&gt;
           :     * Burst a PDF Document into Single Pages&lt;br /&gt;
           :     * Report on PDF Metrics, including Metadata and Bookmarks&lt;br /&gt;
           :     * Uncompress and Re-Compress Page Streams&lt;br /&gt;
           :     * Repair Corrupted PDF (Where Possible)&lt;br /&gt;
&lt;br /&gt;
== pdftk ==&lt;br /&gt;
&lt;br /&gt;
See [[Linux/pdftk]]&lt;br /&gt;
&lt;br /&gt;
== Crop Margins ==&lt;br /&gt;
&lt;br /&gt;
PDFcrop&lt;br /&gt;
&lt;br /&gt;
Install:&lt;br /&gt;
 yum install texlive-utils&lt;br /&gt;
 apt-get install texlive-extra-utils&lt;br /&gt;
&lt;br /&gt;
If you wish to crop a pdf with left, top, right and bottom margins of 5, 10, 20, and 30 pt (points), then run: [http://askubuntu.com/questions/124692/command-line-tool-to-crop-pdf-files]&lt;br /&gt;
 pdfcrop --margins &amp;#039;5 10 20 30&amp;#039; input.pdf output.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Crop 5pts all margins:&lt;br /&gt;
 pdfcrop --margins 5 input.pdf output.pdf&lt;br /&gt;
&lt;br /&gt;
Rulebook example:&lt;br /&gt;
 pdfcrop --margins &amp;quot;-50 -35 -50 -35&amp;quot; STF-Rulebook.pdf out.pdf&lt;br /&gt;
&lt;br /&gt;
== keywords ==&lt;br /&gt;
&lt;br /&gt;
[[Category:Linux]]&lt;/div&gt;</summary>
		<author><name>Kenneth</name></author>
	</entry>
</feed>