You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ms...@apache.org on 2015/09/26 14:47:37 UTC

svn commit: r1705445 - /pdfbox/cmssite/trunk/content/2.0/commandline.md

Author: msahyoun
Date: Sat Sep 26 12:47:37 2015
New Revision: 1705445

URL: http://svn.apache.org/viewvc?rev=1705445&view=rev
Log:
PDFBOX-1450: document command line tools; update Encrypt command

Added:
    pdfbox/cmssite/trunk/content/2.0/commandline.md

Added: pdfbox/cmssite/trunk/content/2.0/commandline.md
URL: http://svn.apache.org/viewvc/pdfbox/cmssite/trunk/content/2.0/commandline.md?rev=1705445&view=auto
==============================================================================
--- pdfbox/cmssite/trunk/content/2.0/commandline.md (added)
+++ pdfbox/cmssite/trunk/content/2.0/commandline.md Sat Sep 26 12:47:37 2015
@@ -0,0 +1,217 @@
+Title:     Command Line Tools
+
+# Command Line Tools
+
+PDFBox comes with a series of command line utilities. They are available as standard Java applications.
+
+See the Dependencies page for instructions on how to set your classpath in order to run 
+PDFBox tools as Java applications.
+
+[TOC]
+
+## Decrypt ## {#decrypt}
+
+This application will decrypt a PDF document.
+
+NOTE: You must have the owner password to decrypt the document!
+
+usage: ``java -jar pdfbox-app-2.y.z.jar Decrypt [OPTIONS] <inputfile> [outputfile]``
+
+| Command Line Parameter 	| Description |
+| ------------------------- | ----------- |
+| -password | Password to the PDF or certificate in keystore. |
+| -keyStore | Path to keystore that holds certificate to decrypt the document. This is only required if the document is encrypted with a certificate, otherwise only the password is required. |
+| -alias | The alias to the certificate in the keystore. |
+| inputfile | The PDF file to decrypt. |
+| outputfile | The file to save the decrypted document to. If left blank then it will be the same as the input file. |
+
+## Encrypt ## {#encrypt}
+
+This application will encrypt a PDF document.
+
+usage: ``java -jar pdfbox-app-2.y.z.jar Encrypt [OPTIONS] <password> <inputfile>``
+
+| Command Line Parameter | Default | Description |
+| -- | -- | -- |
+| -O | | The owner password to the PDF, ignored if -certFile is specified. |
+| -U | | The user password to the PDF, ignored if -certFile is specified. |
+| -certFile | | Path to X.509 cert file. |
+| -canAssemble | true | Set the assemble permission. |
+| -canExtractContent | true | Set the extraction permission. |
+| -canExtractForAccessibility | true | Set the extraction permission. |
+| -canFillInForm | true | Set the fill in form permission. |
+| -canModify | true | Set the modify permission. |
+| -canModifyAnnotations | true | Set the modify annots permission. |
+| -canPrint | true | Set the print permission. |
+| -canPrintDegraded | true | Set the print degraded permission. |
+| -keyLength | 40, 128 or 256 | The number of bits for the encryption key. For 128 and above bits [Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files](http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html) must be installed.|
+| inputfile |  |The PDF file to encrypt. |
+| outputfile |  |The file to save the encrypted document to. If left blank then it will be the same as the input file. |
+
+## ExtractText ## {#extractText}
+
+This application will extract all text from the given PDF document.
+
+usage: ``java -jar pdfbox-app-2.y.z.jar ExtractText [OPTIONS] <inputfile> [Text file] ``
+
+| Command Line Parameter | Default | Description |
+| -- | -- | -- |
+| -password |  | The password to the PDF document. |
+| -encoding | default encoding | The encoding type of the text file, e.g. ISO-8859-1, UTF-8, UTF-16BE. |
+| -console | false | Send text to console instead of file. |
+| -html | false | Output in HTML format instead of raw text. |
+| -sort | false | Sort the text before writing. |
+| -ignoreBeads | false | Disables the separation by beads. |
+| -force | false | Enables pdfbox to ignore corrupt objects. |
+| -debug | false | Enables debug output about the time consumption of every stage. |
+| -startPage | 1 | The first page to extract, one based. |
+| -endPage | Integer.MAX_INT | The last page to extract, one based. |
+| -nonSeq | false | Use the new non sequential parser. |
+
+## OverlayPDF ## {#overlayPDF}
+
+This application will overlay one document with the content of another document
+
+usage: ``java -jar pdfbox-app-2.y.z.jar OverlayPDF <input.pdf> [OPTIONS] <output.pdf>``
+
+| Command Line Parameter | Default | Description |
+| -- | -- | -- |
+| inputfile | | The PDF file to be overlayed. |
+| defaultOverlay.pdf  | | Default overlay file. |
+| -odd oddPageOverlay.pdf| | Overlay file used for odd pages. |
+| -even evenPageOverlay.pdf| | Overlay file used for even pages. |
+| -first firstPageOverlay.pdf| | Overlay file used for the first page. |
+| -last lastPageOverlay.pdf| | Overlay file used for the last pages. |
+| -page pageNumber specificPageOverlay.pdf| | overlay file used for the given page number, may occur more than once. |
+| -position | background | Where to put the overlay, foreground or background. |
+| -nonSeq | false | Use the new non sequential parser. |
+| outputfile | | The resulting pdf file. |
+
+Examples:
+
+- OverlayPDF input.pdf overlay.pdf -nonSeq output.pdf
+- OverlayPDF input.pdf defaultOverlay.pdf -page 10 overlayForPage10.pdf -position foreground -nonSeq output.pdf
+- OverlayPDF input.pdf -odd oddOverlay.pdf -even evenOverlay.pdf -nonSeq output.pdf
+
+## PDFDebugger ## {#pdfDebugger}
+
+This application will take an existing PDF document and allows to analyze and inspect the internal structure
+
+usage: ``java -jar pdfbox-app-2.y.z.jar PDFDebugger [inputfile] ``
+
+| Command Line Parameter | Default | Description |
+| -- | -- | -- |
+| -password | | The password to the PDF document. |
+| -nonSeq | false | Use the new non sequential parser.
+| inputfile | | the name of an optional PDF file to open. |
+
+## PDFMerger ## {#pdfMerger}
+
+This application will take a list of pdf documents and merge them, saving the result in a new document.
+
+usage: ``java -jar pdfbox-app-2.y.z.jar PDFMerger <Source PDF files (2 ..n)> <Target PDF file>``
+
+## PDFReader ## {#pdfReader}
+
+An application to read PDF documents. This will provide Acrobat Reader like functionality.
+
+usage: ``java -jar pdfbox-app-2.y.z.jar PDFReader [PDF file]``
+
+| Command Line Parameter | Default | Description |
+| -- | -- | -- |
+| -password | | The password to the PDF document.|
+| -nonSeq | false | Use the new non sequential parser.|
+| PDF file 	| | the name of an optional PDF file to open |
+
+## PDFSplit ## {#pdfSplit}
+
+This application will take an existing PDF document and split it into a number of other documents
+
+usage: ``java -jar pdfbox-app-2.y.z.jar PDFSplit [OPTIONS] <PDF file>``
+
+| Command Line Parameter | Default | Description |
+| -- | -- | -- |
+| -password | | The password to the PDF document. |
+| -split | | Number of pages of every splitted part of the pdf.|
+| -startPage | | The page to start at. |
+| -endPage | | The page to stop at. |
+| -nonSeq | false | Use the new non sequential parser.|
+
+Examples:
+
+ - PDFSplit -split 2 sample_with_13_pages.pdf will split the pdf in pieces of 2 pages each except the last which will contain 1 page only.
+ - PDFSplit -startPage 5 sample_with_13_pages.pdf will provide a pdf containing all pages of the source pdf starting at page 5
+ - PDFSplit -startPage 5 -endPage 10 sample_with_13_pages.pdf will provide a pdf containing all pages from 5 to 10 of the source pdf
+ - PDFSplit -split 2 -startPage 5 -endPage 10 sample_with_13_pages.pdf will provide 3 pdfs containing all pages from 5 to 10 of the source pdf 2 pages each
+
+## PDFToImage ## {#pdfToImage}
+
+This application will create an image for every page in the PDF document.
+
+usage: ``java -jar pdfbox-app-2.y.z.jar PDFToImage [OPTIONS] <PDF file>``
+
+| Command Line Parameter | Default | Description |
+| -- | -- | -- |
+| -password | | The password to the PDF document.|
+| -imageType | jpg | The image type to write to. Currently only jpg or png. |
+| -outputPrefix | Name of PDF document | The prefix to the image file. |
+| -startPage | 1 | The first page to convert, one based. |
+| -endPage | Integer.MAX_INT | The last page to convert, one based. |
+| -nonSeq | false | Use the new non sequential parser. | 
+
+## PrintPDF ## {#printPDF}
+
+This application will send a pdf document to the printer.
+
+<p class="alert alert-info">You must have the correct permissions to print the document!</p>
+
+usage: ``java -jar pdfbox-app-2.y.z.jar PrintPDF [OPTIONS] <inputfile>``
+
+| Command Line Parameter | Description |
+| -- | -- |
+| -password | The password to decrypt the PDF. |
+| -silentPrint | Print the PDF without prompting for a printer. |
+| inputfile | The PDF file to print. |
+
+## TextToPDF ## {#textToPDF}
+
+This application will create a PDF document from a text file.
+
+usage: ``java -jar pdfbox-app-2.y.z.jar TextToPDF [OPTIONS] <outputfile> <textfile>``
+
+| Command Line Parameter | Default | Description |
+| -- | -- | -- |
+| -standardFont | Helvetica | The font to use for the text. Either this or -ttf should be specified but not both. |
+| -ttf | | The TTF font to use for the text. Either this or -standardFont should be specified but not both. |
+| -fontSize | 10 | The size of the font to use. |
+
+The following font names can be used for the parameter ``standardFont``:
+
+ - Courier
+ - Courier-Bold
+ - Courier-Oblique
+ - Courier-BoldOblique
+ - Helvetica
+ - Helvetica-Bold
+ - Helvetica-Oblique
+ - Helvetica-BoldOblique
+ - Symbol
+ - Times-Bold
+ - Times-Roman
+ - Times-Italic
+ - Times-BoldItalic
+ - ZapfDingbats
+ 
+## WriteDecodedDoc ## {#writeDecodeDoc}
+
+An application to decompress PDF documents.
+
+usage: ``java -jar pdfbox-app-2.y.z.jar WriteDecodedDoc <input-file> <output-file>``
+
+| Command Line Parameter | Default | Description |
+| -- | -- | -- |
+| -password |  | The password to the PDF document. |
+| -nonSeq 	| false | Use the new non sequential parser. |
+| <input-file> |  | The PDF file to decompress |
+| <output-file> |  | The destination PDF file |
+