PDFBOX-3030: add content to pdfbox-docs

Project: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/commit/78a43732
Tree: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/tree/78a43732
Diff: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/diff/78a43732

Branch: refs/heads/master
Commit: 78a43732db9cbefa60d8e3b9b0d39e682259d7b1
Parents: 281369e
Author: Maruan Sahyoun <sahy...@fileaffairs.de>
Authored: Fri Oct 30 11:35:23 2015 +0100
Committer: Maruan Sahyoun <sahy...@fileaffairs.de>
Committed: Fri Oct 30 11:35:23 2015 +0100

----------------------------------------------------------------------
 _config.yml                                     |   24 +
 content/.htaccess                               |   10 +
 content/1.8/architecture.mdtext                 |  104 +
 content/1.8/commandline.mdtext                  |  232 +
 content/1.8/cookbook/documentcreation.mdtext    |   57 +
 content/1.8/cookbook/encryption.md              |   55 +
 content/1.8/cookbook/pdfacreation.mdtext        |   76 +
 content/1.8/cookbook/pdfavalidation.mdtext      |   85 +
 content/1.8/cookbook/textextraction.mdtext      |  101 +
 .../1.8/cookbook/workingwithattachments.mdtext  |   54 +
 content/1.8/cookbook/workingwithfonts.mdtext    |  129 +
 content/1.8/cookbook/workingwithmetadata.mdtext |   66 +
 content/1.8/dependencies.mdtext                 |   96 +
 content/1.8/faq.mdtext                          |  143 +
 content/2.0/commandline.md                      |  214 +
 content/2.0/cookbook/encryption.md              |   53 +
 content/2.0/dependencies.mdtext                 |   56 +
 content/2.0/examples.mdtext                     |    9 +
 content/2.0/getting-started.mdtext              |   33 +
 content/2.0/migration.md                        |  160 +
 content/_layouts/default.html                   |  187 +
 content/assets/open-iconic/.gitignore           |    1 +
 content/assets/open-iconic/FONT-LICENSE         |   86 +
 content/assets/open-iconic/ICON-LICENSE         |   21 +
 .../font/css/open-iconic-bootstrap.css          |  952 +++
 .../font/css/open-iconic-bootstrap.less         |  960 +++
 .../font/css/open-iconic-bootstrap.min.css      |    1 +
 .../font/css/open-iconic-bootstrap.scss         |  958 +++
 .../font/css/open-iconic-bootstrap.styl         |  954 +++
 .../font/css/open-iconic-foundation.css         | 1395 ++++
 .../font/css/open-iconic-foundation.less        | 1397 ++++
 .../font/css/open-iconic-foundation.min.css     |    1 +
 .../font/css/open-iconic-foundation.scss        | 1398 ++++
 .../font/css/open-iconic-foundation.styl        | 1392 ++++
 .../assets/open-iconic/font/css/open-iconic.css |  511 ++
 .../open-iconic/font/css/open-iconic.less       |  962 +++
 .../open-iconic/font/css/open-iconic.min.css    |    1 +
 .../open-iconic/font/css/open-iconic.scss       |  963 +++
 .../open-iconic/font/css/open-iconic.styl       |  733 ++
 .../open-iconic/font/fonts/open-iconic.eot      |  Bin 0 -> 28196 bytes
 .../open-iconic/font/fonts/open-iconic.otf      |  Bin 0 -> 20996 bytes
 .../open-iconic/font/fonts/open-iconic.svg      |  543 ++
 .../open-iconic/font/fonts/open-iconic.ttf      |  Bin 0 -> 28028 bytes
 .../open-iconic/font/fonts/open-iconic.woff     |  Bin 0 -> 14984 bytes
 content/bootstrap/css/bootstrap-responsive.css  | 1109 +++
 .../bootstrap/css/bootstrap-responsive.min.css  |    9 +
 content/bootstrap/css/bootstrap-theme.css       |  470 ++
 content/bootstrap/css/bootstrap-theme.css.map   |    1 +
 content/bootstrap/css/bootstrap-theme.min.css   |    5 +
 content/bootstrap/css/bootstrap.css             | 6332 ++++++++++++++++++
 content/bootstrap/css/bootstrap.css.map         |    1 +
 content/bootstrap/css/bootstrap.min.css         |    5 +
 .../fonts/glyphicons-halflings-regular.eot      |  Bin 0 -> 20335 bytes
 .../fonts/glyphicons-halflings-regular.svg      |  229 +
 .../fonts/glyphicons-halflings-regular.ttf      |  Bin 0 -> 41280 bytes
 .../fonts/glyphicons-halflings-regular.woff     |  Bin 0 -> 23320 bytes
 .../img/glyphicons-halflings-white.png          |  Bin 0 -> 8777 bytes
 content/bootstrap/img/glyphicons-halflings.png  |  Bin 0 -> 12799 bytes
 content/bootstrap/js/bootstrap.js               | 2320 +++++++
 content/bootstrap/js/bootstrap.min.js           |    7 +
 content/bootstrap/js/npm.js                     |   13 +
 content/building.mdtext                         |   70 +
 content/codingconventions.mdtext                |  128 +
 content/css/pygments-default.css                |   61 +
 content/css/pygments-friendly.css               |   61 +
 content/css/pygments-github.css                 |   61 +
 content/css/site.css                            |  155 +
 content/doap_PDFBox.rdf                         |  214 +
 content/download.cgi                            |    6 +
 content/download.html                           |  261 +
 content/errors/403.mdtext                       |   15 +
 content/errors/404.mdtext                       |   15 +
 content/favicon.ico                             |  Bin 0 -> 378 bytes
 content/ideas.mdtext                            |   88 +
 content/images/footer.png                       |  Bin 0 -> 4579 bytes
 content/images/logo-head.gif                    |  Bin 0 -> 7256 bytes
 content/index.mdtext                            |   81 +
 content/mailinglists.mdtext                     |   28 +
 content/references.mdtext                       |   48 +
 content/sitemap.html                            |    2 +
 content/siteupdate.md                           |   32 +
 content/support.mdtext                          |   53 +
 content/team.mdtext                             |   45 +
 pom.xml                                         |   64 +
 84 files changed, 27162 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/_config.yml
----------------------------------------------------------------------
diff --git a/_config.yml b/_config.yml
new file mode 100644
index 0000000..6fd80fc
--- /dev/null
+++ b/_config.yml
@@ -0,0 +1,24 @@
+# Site settings
+title: Apache PDFBox | A Java PDF Library
+description: > # this means to ignore newlines until "baseurl:"
+  The Apache PDFBox™ library is an open source Java tool for working with 
PDF documents.
+  This project allows creation of new PDF documents, manipulation of existing 
documents
+  and the ability to extract content from documents. Apache PDFBox also 
includes several
+  command line utilities. Apache PDFBox is published under the Apache License 
v2.0.
+baseurl: ""
+url: "http://pdfbox.apache.org/";
+
+
+# Build settings
+source: ./content
+destination: ./staging
+layouts_dir:  _layouts
+
+markdown_ext: "markdown,mkdown,mkdn,mkd,md,mdtext"
+
+encoding: UTF-8
+markdown: redcarpet
+
+redcarpet:
+    extensions: ["no_intra_emphasis", "tables", "autolink", "strikethrough", 
"with_toc_data"]
+

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/.htaccess
----------------------------------------------------------------------
diff --git a/content/.htaccess b/content/.htaccess
new file mode 100644
index 0000000..bdc50ee
--- /dev/null
+++ b/content/.htaccess
@@ -0,0 +1,10 @@
+RewriteEngine On
+RewriteRule ^apidocs(/?)$ /docs/1.8.10/javadocs [R=301,L]
+RewriteRule ^commandlineutilities(/?)(.*)$ /commandline [R=301,L]
+RewriteRule ^downloads\.html$ /download.cgi
+RewriteRule ^downloads\.cgi$ /download.cgi
+
+ErrorDocument 403 /errors/403.html
+ErrorDocument 404 /errors/404.html
+
+Options -Indexes

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/1.8/architecture.mdtext
----------------------------------------------------------------------
diff --git a/content/1.8/architecture.mdtext b/content/1.8/architecture.mdtext
new file mode 100644
index 0000000..3ecce7a
--- /dev/null
+++ b/content/1.8/architecture.mdtext
@@ -0,0 +1,104 @@
+---
+layout: default
+title:  Architecture
+---
+
+# Architecture
+
+In order to get the most out of PDFBox it is neccessary to understand how a 
PDF document
+is organized as PDFBox was architected around the concepts layed out in the 
+ISO-32000 (PDF) Specification
+
+- [ISO Site](http://www.iso.org/iso/catalogue_detail.htm?csnumber=51502)
+- [Adobe 
Version](http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf)
+
+## Quick Introduction to the PDF format
+
+A PDF file is made up of a sequence of bytes. These bytes, grouped into 
tokens, 
+make up the basic objects upon which higher level objects and structures are 
built [see ISO-32000 7.3].
+
+<p class="alert alert-info">PDFBox makes these basic objects available in the 
+*org.apache.pdfbox.cos* package (The COS Model).
+</p>
+
+The organization of these objects, how to they are read and how to write them 
is defined in the file structure of the 
+PDF [see ISO-32000 7.5]. In addition a file can be encrpyted to protect the 
document's content [see ISO-32000 7.5].
+
+<p class="alert alert-info">PDFBox handles the reading in the 
*org.apache.pdfbox.pdfparser* package. 
+Writing of PDF files is handled in the *org.apache.pdfbox.pdfwriter* package.
+</p>
+
+Within the file structure basic objects are used to create a document 
structure building higher level objects such 
+as pages, bookmarks, annotations [see ISO-32000 7.7].
+
+<p class="alert alert-info">PDFBox makes these higher level objects available 
through the 
+*org.apache.pdfbox.pdfmodel* package (The PD Model).
+</p> 
+
+In addition there is a COS representation available for the PD model if there 
is a need to 
+inspect the underlying structure or to handle special cases where the higher 
level PD model
+doesn't provide the functionality needed.
+
+<p class="alert alert-info">It's always the COS model which is represented in 
the PDF file.</p>
+
+## The COS Model
+
+As outlined above the basic PDF objects are represented in PDFBox in the 
org.apache.pdfbox.cos package.
+
+| PDF Type | Description | Example | PDFBox class | ISO 32000 |
+| --- | --- | --- | --- | --- |
+| Boolean | Standard True/False values | true | 
org.apache.pdfbox.cos.COSBoolean | 7.3.2 |
+| Number | Integer and floating point numbers | 1 2.3 | 
org.apache.pdfbox.cos.COSInteger<br/>org.apache.pdfbox.cos.COSFloat | 7.3.3 |
+| String | A sequence of characters | (This is a string) | 
org.apache.pdfbox.cos.COSString | 7.3.4 |
+| Name | A predefined value in a PDF document, typically used as a key in a 
dictionary | /Type | org.apache.pdfbox.cos.COSName | 7.3.5 |
+| Array | Arrays are one-dimensional lists of objects accessed by a numeric 
index. Within an array each basic object is permitted as an entry. | [549 3.14 
false (Ralph) /SomeName] | org.apache.pdfbox.cos.COSArray | 7.3.6 |
+| Dictionary | A map of name value pairs | <<<br/>/Type /XObject<br/>/Name 
(Name)</br>/Size 1</br>>> | org.apache.pdfbox.cos.COSDictionary | 7.3.7 |
+| Stream | A stream of data, typically compressed. This is used for page 
contents, images and embedded font streams. | 12 0 obj << /Type /XObject >> 
stream 030004040404040404 endstream | org.apache.pdfbox.cos.COSStream | 7.3.8 |
+| Object | A wrapper to any of the other objects, this can be used to 
reference an object multiple times. An object is referenced by using two 
numbers, an object number and a generation number. Initially the generation 
number will be zero unless the object got replaced later in the stream. | 12 0 
obj << /Type /XObject >> endobj | org.apache.pdfbox.cos.COSObject | |
+
+A page in a pdf document is represented with a COSDictionary. The entries that 
are available for a page can be seen in the PDF Reference and an example of a 
page looks like this:
+
+```text
+<<
+    /Type /Page
+    /MediaBox [0 0 612 915]
+    /Contents 56 0 R
+>>
+```
+
+The information within the dictionary can be accessed using the COS model
+
+```java
+COSDictionary page = ...;
+COSArray mediaBox = (COSArray)page.getDictionaryObject( "MediaBox" );
+System.out.println( "Width:" + mediaBox.get( 3 ) );
+```
+
+As can be seen from that little example the COS model provides a low level API 
to access 
+information within the PDF. In order to use the COS model successfully a good 
knowledge of
+the PDF specification is needed.
+
+## The PD Model
+
+The COS Model allows access to all aspects of a PDF document. This type of 
programming is
+tedious and error prone though because the user must know all of the names of 
the
+parameters and no helper methods are available. The PD Model was created to 
help
+alleviate this problem. Each type of object(page, font, image) has a set of 
defined
+attributes that can be available in the dictionary. 
+A PD Model class is available for each of these so that strongly typed methods 
are
+available to access the attributes. 
+
+The same code from above to get the page width can be rewritten to use PD 
Model classes.
+
+```java
+PDPage page = ...;
+PDRectangle mediaBox = page.getMediaBox();
+System.out.println( "Width:" + mediaBox.getWidth() );
+```
+
+PD Model objects sit on top of COS model. Typically, the classes in the PD 
Model will only
+store a COS object and all setter/getter methods will modify data that is 
stored in the
+COS object. For example, when you call PDPage.getLastModified() the method 
will do a
+lookup in the COSDictionary with the key "LastModified", if it is found the 
value is then
+converter to a java.util.Calendar. When PDPage.setLastModified( Calendar ) is 
called then
+the Calendar is converted to a string in the COSDictionary.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/1.8/commandline.mdtext
----------------------------------------------------------------------
diff --git a/content/1.8/commandline.mdtext b/content/1.8/commandline.mdtext
new file mode 100644
index 0000000..c0efac1
--- /dev/null
+++ b/content/1.8/commandline.mdtext
@@ -0,0 +1,232 @@
+---
+layout: default
+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.
+
+**Table of Contents**  
+[Decrypt](#decrypt)
+[Encrypt](#encrypt)
+[ExtractText](#extracttext) 
+[OverlayPDF](#overlaypdf)
+[PrintPDF](#printpdf)
+[PDFDebugger](#pdfdebugger)
+[PDFReader](#pdfreader)
+[PDFMerger](#pdfmerger)
+[PDFSplit](#pdfsplit)
+[PDFToImage](#pdftoimage)
+[TextToPDF](#texttopdf)
+[WriteDecodedDoc](#writedecodeddoc)
+
+## Decrypt ##
+
+This application will decrypt a PDF document.
+
+NOTE: You must have the owner password to decrypt the document!
+
+usage: ``java -jar pdfbox-app-x.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 ##
+
+This application will encrypt a PDF document.
+
+usage: ``java -jar pdfbox-app-x.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 or 128 | The number of bits for the encryption key. For 128 
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 ##
+
+This application will extract all text from the given PDF document.
+
+usage: ``java -jar pdfbox-app-x.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 ##
+
+This application will overlay one document with the content of another document
+
+usage: ``java -jar pdfbox-app-x.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
+
+## 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-x.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. |
+
+## PDFDebugger ##
+
+This application will take an existing PDF document and allows to analyze and 
inspect the internal structure
+
+usage: ``java -jar pdfbox-app-x.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. |
+
+## PDFReader ##
+
+An application to read PDF documents. This will provide Acrobat Reader like 
functionality.
+
+usage: ``java -jar pdfbox-app-x.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 |
+
+## 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-x.y.z.jar PDFMerger <Source PDF files (2 ..n)> 
<Target PDF file>``
+
+## PDFSplit ## {#pdfSplit}
+
+This application will take an existing PDF document and split it into a number 
of other documents
+
+usage: ``java -jar pdfbox-app-x.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 ##
+
+This application will create an image for every page in the PDF document.
+
+usage: ``java -jar pdfbox-app-x.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. | 
+
+## TextToPDF ##
+
+This application will create a PDF document from a text file.
+
+usage: ``java -jar pdfbox-app-x.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 ##
+
+An application to decompress PDF documents.
+
+usage: ``java -jar pdfbox-app-x.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 |
+

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/1.8/cookbook/documentcreation.mdtext
----------------------------------------------------------------------
diff --git a/content/1.8/cookbook/documentcreation.mdtext 
b/content/1.8/cookbook/documentcreation.mdtext
new file mode 100644
index 0000000..b41c766
--- /dev/null
+++ b/content/1.8/cookbook/documentcreation.mdtext
@@ -0,0 +1,57 @@
+---
+layout: default
+title:  Cookbook - Document Creation
+---
+
+# Document Creation
+
+## Create a blank PDF
+
+This small sample shows how to create a new PDF document using PDFBox.
+
+~~~java
+// Create a new empty document
+PDDocument document = new PDDocument();
+
+// Create a new blank page and add it to the document
+PDPage blankPage = new PDPage();
+document.addPage( blankPage );
+
+// Save the newly created document
+document.save("BlankPage.pdf");
+
+// finally make sure that the document is properly
+// closed.
+document.close();
+~~~
+
+## Hello World using a PDF base font
+
+This small sample shows how to create a new document and print the text "Hello 
World" using one of the PDF base fonts.
+
+~~~java
+// Create a document and add a page to it
+PDDocument document = new PDDocument();
+PDPage page = new PDPage();
+document.addPage( page );
+
+// Create a new font object selecting one of the PDF base fonts
+PDFont font = PDType1Font.HELVETICA_BOLD;
+
+// Start a new content stream which will "hold" the to be created content
+PDPageContentStream contentStream = new PDPageContentStream(document, page);
+
+// Define a text content stream using the selected font, moving the cursor and 
drawing the text "Hello World"
+contentStream.beginText();
+contentStream.setFont( font, 12 );
+contentStream.moveTextPositionByAmount( 100, 700 );
+contentStream.drawString( "Hello World" );
+contentStream.endText();
+
+// Make sure that the content stream is closed:
+contentStream.close();
+
+// Save the results and ensure that the document is properly closed:
+document.save( "Hello World.pdf");
+document.close();
+~~~
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/1.8/cookbook/encryption.md
----------------------------------------------------------------------
diff --git a/content/1.8/cookbook/encryption.md 
b/content/1.8/cookbook/encryption.md
new file mode 100644
index 0000000..1507e2d
--- /dev/null
+++ b/content/1.8/cookbook/encryption.md
@@ -0,0 +1,55 @@
+---
+layout: default
+license: Licensed to the Apache Software Foundation (ASF) under one
+         or more contributor license agreements.  See the NOTICE file
+         distributed with this work for additional information
+         regarding copyright ownership.  The ASF licenses this file
+         to you under the Apache License, Version 2.0 (the
+         "License"); you may not use this file except in compliance
+         with the License.  You may obtain a copy of the License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+         Unless required by applicable law or agreed to in writing,
+         software distributed under the License is distributed on an
+         "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+         KIND, either express or implied.  See the License for the
+         specific language governing permissions and limitations
+         under the License.
+         
+title: Cookbook - Encrypting a file
+---
+
+Encrypting a file
+=================
+
+PDF encryption requires two passwords: the "user password" to open and view 
the file with restricted permissions, the "owner password" to access the file 
with all permission.
+
+
+Load and save encrypted
+-----------------------
+
+This small sample shows how to encrypt a file so that it can be viewed, but 
not printed..
+
+~~~java
+PDDocument doc = PDDocument.load("filename.pdf");
+
+// Define the length of the encryption key.
+// Possible values are 40 or 128 (256 will be available in PDFBox 2.0).
+int keyLength = 128;
+
+AccessPermission ap = new AccessPermission();
+
+// disable printing, everything else is allowed
+ap.setCanPrint(false);
+
+// owner password (to open the file with all permissions) is "12345"
+// user password (to open the file but with restricted permissions, is empty 
here) 
+StandardProtectionPolicy spp = new StandardProtectionPolicy("12345", "", ap);
+spp.setEncryptionKeyLength(keyLength);
+spp.setPermissions(ap);
+doc.protect(spp);
+
+doc.save("filename-encrypted.pdf");
+doc.close();
+~~~
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/1.8/cookbook/pdfacreation.mdtext
----------------------------------------------------------------------
diff --git a/content/1.8/cookbook/pdfacreation.mdtext 
b/content/1.8/cookbook/pdfacreation.mdtext
new file mode 100644
index 0000000..7bfe9e0
--- /dev/null
+++ b/content/1.8/cookbook/pdfacreation.mdtext
@@ -0,0 +1,76 @@
+---
+layout: default
+title:     Create a valid PDF/A document
+Notice:    Licensed to the Apache Software Foundation (ASF) under one
+           or more contributor license agreements.  See the NOTICE file
+           distributed with this work for additional information
+           regarding copyright ownership.  The ASF licenses this file
+           to you under the Apache License, Version 2.0 (the
+           "License"); you may not use this file except in compliance
+           with the License.  You may obtain a copy of the License at
+           .
+             http://www.apache.org/licenses/LICENSE-2.0
+           .
+           Unless required by applicable law or agreed to in writing,
+           software distributed under the License is distributed on an
+           "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+           KIND, either express or implied.  See the License for the
+           specific language governing permissions and limitations
+           under the License.
+---
+
+# PDF/A Creation
+
+The Apache PDFBox API can be used to create a PDF/A File. PDF/A is a PDF file 
with some constraints to ensure its 
+long time conservation. These constraints are described in ISO 19005.
+
+This small sample shows what should be added during creation of a PDF file to 
transform it in a valid PDF/A 
+document. The current example creates a valid PDF/A-1b document.
+
+## Load all the fonts used in document
+
+The PDF/A specification enforces that the fonts used in the document are 
present in the PDF File. You
+have to load them. As an example:
+
+~~~java
+InputStream fontStream = 
CreatePDFA.class.getResourceAsStream("/org/apache/pdfbox/resources/ttf/ArialMT.ttf");
+PDFont font = PDTrueTypeFont.loadTTF(doc, fontStream);
+~~~
+## Including XMP metadata block
+
+It is imposed to have xmp metadata defined in the PDF. At least, the PDFA 
Schema (giving details on the version
+of PDF/A specification reached by the document) must be present. These lines 
create the xmp metadata for a
+PDF/A-1b document:
+
+~~~java
+XMPMetadata xmp = new XMPMetadata();
+XMPSchemaPDFAId pdfaid = new XMPSchemaPDFAId(xmp);
+xmp.addSchema(pdfaid);
+pdfaid.setConformance("B");
+pdfaid.setPart(1);
+pdfaid.setAbout("");
+metadata.importXMPMetadata(xmp);
+~~~
+
+## Including color profile
+
+It is mandatory to include the color profile used by the document. Different 
profiles can be used. This 
+example takes one present in pdfbox:
+
+~~~java
+// create output intent
+InputStream colorProfile = 
CreatePDFA.class.getResourceAsStream("/org/apache/pdfbox/resources/pdfa/sRGB 
Color Space Profile.icm");
+PDOutputIntent oi = new PDOutputIntent(doc, colorProfile); 
+oi.setInfo("sRGB IEC61966-2.1"); 
+oi.setOutputCondition("sRGB IEC61966-2.1"); 
+oi.setOutputConditionIdentifier("sRGB IEC61966-2.1"); 
+oi.setRegistryName("http://www.color.org";); 
+cat.addOutputIntent(oi);
+~~~~
+
+## Complete example
+
+The complete example can be found in pdfbox-example. The source file is
+
+       src/main/java/org/apache/pdfbox/examples/pdfa/CreatePDFA.java
+

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/1.8/cookbook/pdfavalidation.mdtext
----------------------------------------------------------------------
diff --git a/content/1.8/cookbook/pdfavalidation.mdtext 
b/content/1.8/cookbook/pdfavalidation.mdtext
new file mode 100644
index 0000000..bef22e9
--- /dev/null
+++ b/content/1.8/cookbook/pdfavalidation.mdtext
@@ -0,0 +1,85 @@
+---
+layout: default
+title: Cookbook - PDF/A Validation
+---
+
+# PDF/A Validation
+
+The Apache Preflight library is a Java tool that implements a parser compliant 
with the ISO-19005 specification (aka PDF/A-1).
+Check Compliance with PDF/A-1b
+
+This small sample shows how to check the compliance of a file with the 
PDF/A-1b specification.
+
+~~~java
+ValidationResult result = null;
+
+FileDataSource fd = new FileDataSource(args[0]);
+PreflightParser parser = new PreflightParser(fd);
+try
+{
+
+    /* Parse the PDF file with PreflightParser that inherits from the 
NonSequentialParser.
+     * Some additional controls are present to check a set of PDF/A 
requirements. 
+     * (Stream length consistency, EOL after some Keyword...)
+     */
+    parser.parse();
+
+    /* Once the syntax validation is done, 
+     * the parser can provide a PreflightDocument 
+     * (that inherits from PDDocument) 
+     * This document process the end of PDF/A validation.
+     */
+    PreflightDocument document = parser.getPreflightDocument();
+    document.validate();
+
+    // Get validation result
+    result = document.getResult();
+    document.close();
+
+}
+catch (SyntaxValidationException e)
+{
+    /* the parse method can throw a SyntaxValidationException 
+     * if the PDF file can't be parsed.
+     * In this case, the exception contains an instance of ValidationResult  
+     */
+    result = e.getResult();
+}
+
+// display validation result
+if (result.isValid())
+{
+    System.out.println("The file " + args[0] + " is a valid PDF/A-1b file");
+}
+else
+{
+    System.out.println("The file" + args[0] + " is not valid, error(s) :");
+    for (ValidationError error : result.getErrorsList())
+    {
+        System.out.println(error.getErrorCode() + " : " + error.getDetails());
+    }
+}
+~~~
+       
+## Categories of Validation Error
+
+If a validation fails, the ValidationResult object contains all causes of the 
failure.
+In order to help in the failure understanding, all error codes have the 
following form X[.Y[.Z]] where :
+
+ - 'X' is the category (ex : Font validation error...)
+ - 'Y' represent a subsection of the category (ex : "Font with Glyph error")
+ - 'Z' represent the cause of the error (ex : "Font with a missing Glyph")
+
+Category ('Y') and cause ('Z') may be missing according to the difficulty to 
identify the error detail.
+
+Here after, you can find all Categories (for detailed cause, see constants in 
the ``PreflightConstants`` interface) :
+
+| Category | Description |
+| -------- | ----------- | 
+| 1[.y[.z]] | Syntax Error |
+| 2[.y[.z]] | Graphic Error |
+| 3[.y[.z]] | Font Error |
+| 4[.y[.z]] | Transparency Error |
+| 5[.y[.z]] | Annotation Error |
+| 6[.y[.z]] | Action Error |
+| 7[.y[.z]] | Metadata Error |

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/1.8/cookbook/textextraction.mdtext
----------------------------------------------------------------------
diff --git a/content/1.8/cookbook/textextraction.mdtext 
b/content/1.8/cookbook/textextraction.mdtext
new file mode 100644
index 0000000..46237b3
--- /dev/null
+++ b/content/1.8/cookbook/textextraction.mdtext
@@ -0,0 +1,101 @@
+---
+layout: default
+title: Cookbook - Textextraction
+---
+
+# Textextraction
+
+## Extracting Text
+
+See class:org.apache.pdfbox.util.PDFTextStripper  
+See class:org.apache.pdfbox.searchengine.lucene.LucenePDFDocument  
+See command line app:ExtractText  
+
+One of the main features of PDFBox is its ability to quickly and accurately 
extract text 
+from a variety of PDF documents. This functionality is encapsulated in the 
+org.apache.pdfbox.util.PDFTextStripper and can be easily executed on the 
command line with 
+org.apache.pdfbox.ExtractText.
+
+## Lucene Integration
+
+Lucene is an open source text search library from the Apache Jakarta Project. 
In order for
+Lucene to be able to index a PDF document it must first be converted to text. 
PDFBox provides 
+a simple approach for adding PDF documents into a Lucene index.
+
+~~~java
+Document luceneDocument = LucenePDFDocument.getDocument( ... );
+~~~
+
+Now that you hava a Lucene Document object, you can add it to the Lucene index 
just like 
+you would if it had been created from a text or HTML file. The 
LucenePDFDocument automatically 
+extracts a variety of metadata fields from the PDF to be added to the index, 
the javadoc 
+shows details on those fields. This approach is very simple and should be 
sufficient for 
+most users, if not then you can use some of the advanced text extraction 
techniques 
+described in the next section.
+
+## Advanced Text Extraction
+
+Some applications will have complex text extraction requiments and neither the 
command 
+line application nor the LucenePDFDocument will be able to fulfill those 
requirements. 
+It is possible for users to utilize or extend the PDFTextStripper class to 
meet some of 
+these requirements.
+
+### Limiting The Extracted Text
+
+There are several ways that we can limit the text that is extracted during the 
extraction 
+process. The simplest is to specify the range of pages that you want to be 
extracted. 
+For example, to only extract text from the second and third pages of the PDF 
document 
+you could do this:
+
+~~~java
+PDFTextStripper stripper = new PDFTextStripper();
+stripper.setStartPage( 2 );
+stripper.setEndPage( 3 );
+stripper.writeText( ... );
+~~~~
+        
+NOTE: The startPage and endPage properties of PDFTextStripper are 1 based and 
inclusive.
+
+If you wanted to start on page 2 and extract to the end of the document then 
you would just
+set the startPage property. By default all pages in the pdf document are 
extracted.
+
+It is also possible to limit the extracted text to be between two bookmarks in 
the page. 
+If you are not familiar with how to use bookmarks in PDFBox then you should 
review the 
+Bookmarks page. Similar to the startPage/endPage properties, PDFTextStripper 
also has 
+startBookmark/endBookmark properties. There are some caveats to be aware of 
when using this
+feature of the PDFTextStripper. Not all bookmarks point to a page in the 
current PDF document. 
+
+The possible states of a bookmark are:
+
+ - null - The property was not set, this is the default.
+ - Points to page in the PDF - The property was set and points to a valid page 
in the PDF
+ - Bookmark does not point to anything - The property was set but the bookmark 
does not point to any page
+ - Bookmark points to external action - The property was set, but it points to 
a page in a different PDF or performs an action when activated
+
+The table below will describe how PDFBox behaves in the various scenarios:
+
+| Start Bookmark | End Bookmark | Result |
+| -------------- | ------------ | ------ |
+| null | null | This is the default, the properties have no effect on the text 
extraction. |
+| Points to a page in the PDF | null | Text extraction will begin on the page 
that this bookmark points to and go until the end of the document. |
+| null | Points to a page in the PDF | Text extraction will begin on the first 
page and stop at the end of the page that this bookmark points to. |
+| Bookmark does not point to anything | null | Because the PDFTextStripper 
cannot determine a start page based on the bookmark, it will start on the first 
page and go until the end of the document. |
+| null | Bookmark does not point to anything | Because the PDFTextStripper 
cannot determine a end page based on the bookmark, it will start on the first 
page and go until the end of the document. |
+| Bookmark does not point to anything | Bookmark does not point to anything | 
This is a special case! If the startBookmark and endBookmark are exactly the 
same then no text will be extracted. If they are different then it is not 
possible for the PDFTextStripper to determine that pages so it will include the 
entire document. | 
+| Bookmark points to external action | Bookmark points to external action | If 
either the startBookmark or the endBookmark refer to an external page or 
execute an action then an OutlineNotLocalException will be thrown to indicate 
to the user that the bookmark is not valid. |
+
+NOTE: PDFTextStripper will check both the startPage/endPage and the 
startBookmark/endBookmark to determine if text should be extracted from the 
current page.
+
+### External Glyph List
+
+Some PDF files need to map between glyph names and Unicode values during text 
extraction. 
+PDFBox comes with an Adobe Glyph List, but you may encounter files with glyph 
names that 
+are not in that map. To use your own glyphlist file, supply the file name to 
the ``glyphlist_ext`` JVM property.
+
+### Right to Left Text
+
+Extracting text in languages whose text goes from right to left (such as 
Arabic and Hebrew)
+in PDF files can result in text that is backwards. PDFBox can normalize and 
reverse the text
+if the ICU4J jar file has been placed on the classpath (it is an optional 
dependency). 
+Note that you should also enable sorting with either 
org.apache.pdfbox.util.PDFTextStripper 
+or org.apache.pdfbox.ExtractText to ensure accurate output.

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/1.8/cookbook/workingwithattachments.mdtext
----------------------------------------------------------------------
diff --git a/content/1.8/cookbook/workingwithattachments.mdtext 
b/content/1.8/cookbook/workingwithattachments.mdtext
new file mode 100644
index 0000000..9b77301
--- /dev/null
+++ b/content/1.8/cookbook/workingwithattachments.mdtext
@@ -0,0 +1,54 @@
+---
+layout: default
+title: Cookbook - Working with Attachments
+---
+
+# Working with Attachments
+
+## The PDF File Specification
+
+See package:org.apache.pdfbox.pdmodel.common.filespecification  
+See example:EmbeddedFiles  
+
+A PDF can contain references to external files via the file system or a URL to 
a remote 
+location. It is also possible to embed a binary file into a PDF document.
+
+There are two classes that can be used when referencing a file. 
``PDSimpleFileSpecification``
+is a simple string reference to a file(e.g. "./movies/BigMovie.avi"). The 
simple file 
+specification does not allow for any parameters to be set. 
+
+The ``PDComplexFileSpecification`` is more feature rich and allows for 
advanced settings on 
+the file reference.
+
+It is also possible to embed a file directly into a PDF. Instead of setting 
the file 
+attribute of the ``PDComplexFileSpecification``, the ``EmbeddedFile`` 
attribute can be used instead.
+
+## Adding a File Attachment
+
+PDF documents can contain file attachments that are accessed from the 
Document->File Attachments 
+menu. PDFBox allows attachments to be added to and extracted from PDF 
documents. 
+Attachments are part of the named tree that is attached to the document 
catalog.
+
+~~~java
+PDEmbeddedFilesNameTreeNode efTree = new PDEmbeddedFilesNameTreeNode();
+
+//first create the file specification, which holds the embedded file
+PDComplexFileSpecification fs = new PDComplexFileSpecification();
+fs.setFile( "Test.txt" );
+InputStream is = ...;
+PDEmbeddedFile ef = new PDEmbeddedFile(doc, is );
+//set some of the attributes of the embedded file
+ef.setSubtype( "test/plain" );
+ef.setSize( data.length );
+ef.setCreationDate( new GregorianCalendar() );
+fs.setEmbeddedFile( ef );
+
+//now add the entry to the embedded file tree and set in the document.
+Map efMap = new HashMap();
+efMap.put( "My first attachment", fs );
+efTree.setNames( efMap );
+//attachments are stored as part of the "names" dictionary in the document 
catalog
+PDDocumentNameDictionary names = new PDDocumentNameDictionary( 
doc.getDocumentCatalog() );
+names.setEmbeddedFiles( efTree );
+doc.getDocumentCatalog().setNames( names );
+~~~
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/1.8/cookbook/workingwithfonts.mdtext
----------------------------------------------------------------------
diff --git a/content/1.8/cookbook/workingwithfonts.mdtext 
b/content/1.8/cookbook/workingwithfonts.mdtext
new file mode 100644
index 0000000..a3d6165
--- /dev/null
+++ b/content/1.8/cookbook/workingwithfonts.mdtext
@@ -0,0 +1,129 @@
+---
+layout: default
+title:  Cookbook - Working with Fonts
+---
+
+# Working with Fonts
+
+## Standard 14 Fonts
+
+The PDF specification states that a standard set of 14 fonts will always be 
available when consuming PDF documents. In PDFBox these are defined as 
constants in the PDType1Font class.
+
+| Standard Font | Description |
+| ------------- | ----------- |
+| PDType1Font.TIMES_ROMAN | Times regular |
+| PDType1Font.TIMES_BOLD | Times bold |
+| PDType1Font.TIMES_ITALIC | Times italic |
+| PDType1Font.TIMES_BOLD_ITALIC | Times bold italic |
+| PDType1Font.HELVETICA | Helvetica regular |
+| PDType1Font.HELVETICA_BOLD | Helvetica bold |
+| PDType1Font.HELVETICA_OBLIQUE | Helvetica italic |
+| PDType1Font.HELVETICA_BOLD_OBLIQUE | Helvetica bold italic | 
+| PDType1Font.COURIER | Courier |
+| PDType1Font.COURIER_BOLD | Courier bold |
+| PDType1Font.COURIER_OBLIQUE | Courier italic |
+| PDType1Font.COURIER_BOLD_OBLIQUE | Courier bold italic |
+| PDType1Font.SYMBOL | Symbol Set |
+| PDType1Font.ZAPF_DINGBATS | Dingbat Typeface |
+
+## Hello World using a PDF base font
+
+This small sample shows how to create a new document and print the text "Hello 
World" using one of the PDF base fonts.
+
+~~~java
+// Create a document and add a page to it
+PDDocument document = new PDDocument();
+PDPage page = new PDPage();
+document.addPage( page );
+
+// Create a new font object selecting one of the PDF base fonts
+PDFont font = PDType1Font.HELVETICA_BOLD;
+
+// Start a new content stream which will "hold" the to be created content
+PDPageContentStream contentStream = new PDPageContentStream(document, page);
+
+// Define a text content stream using the selected font, moving the cursor and 
drawing the text "Hello World"
+contentStream.beginText();
+contentStream.setFont( font, 12 );
+contentStream.moveTextPositionByAmount( 100, 700 );
+contentStream.drawString( "Hello World" );
+contentStream.endText();
+
+// Make sure that the content stream is closed:
+contentStream.close();
+
+// Save the results and ensure that the document is properly closed:
+document.save( "Hello World.pdf");
+document.close();
+~~~
+
+## Hello World using a TrueType font
+
+This small sample shows how to create a new document and print the text "Hello 
World" using a TrueType font.
+
+~~~java
+// Create a document and add a page to it
+PDDocument document = new PDDocument();
+PDPage page = new PDPage();
+document.addPage( page );
+
+// Create a new font object by loading a TrueType font into the document
+PDFont font = PDTrueTypeFont.loadTTF(document, "Arial.ttf");
+
+// Start a new content stream which will "hold" the to be created content
+PDPageContentStream contentStream = new PDPageContentStream(document, page);
+
+// Define a text content stream using the selected font, moving the cursor and 
drawing the text "Hello World"
+contentStream.beginText();
+contentStream.setFont( font, 12 );
+contentStream.moveTextPositionByAmount( 100, 700 );
+contentStream.drawString( "Hello World" );
+contentStream.endText();
+
+// Make sure that the content stream is closed:
+contentStream.close();
+
+// Save the results and ensure that the document is properly closed:
+document.save( "Hello World.pdf");
+document.close();
+~~~
+
+While it is recommended to embed all fonts for greatest portability not all 
PDF producer 
+applications will do this. When displaying a PDF it is necessary to find an 
external font to use. 
+PDFBox will look for a mapping file to use when substituting fonts.
+
+PDFBox will load Resources/PDFBox_External_Fonts.properties off of the 
classpath to map font
+names to TTF font files. The UNKNOWN_FONT property in that file will tell 
PDFBox which font to 
+use when no mapping exists. 
+
+
+## Hello World using a Postscript Type1 font
+
+This small sample shows how to create a new document and print the text "Hello 
World" using a Postscript Type1 font.
+
+~~~java
+// Create a document and add a page to it
+PDDocument document = new PDDocument();
+PDPage page = new PDPage();
+document.addPage( page );
+
+// Create a new font object by loading a Postscript Type 1 font into the 
document
+PDFont font = new PDType1AfmPfbFont(doc,"cfm.afm");
+
+// Start a new content stream which will "hold" the to be created content
+PDPageContentStream contentStream = new PDPageContentStream(document, page);
+
+// Define a text content stream using the selected font, moving the cursor and 
drawing the text "Hello World"
+contentStream.beginText();
+contentStream.setFont( font, 12 );
+contentStream.moveTextPositionByAmount( 100, 700 );
+contentStream.drawString( "Hello World" );
+contentStream.endText();
+
+// Make sure that the content stream is closed:
+contentStream.close();
+
+// Save the results and ensure that the document is properly closed:
+document.save( "Hello World.pdf");
+document.close();
+~~~
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/1.8/cookbook/workingwithmetadata.mdtext
----------------------------------------------------------------------
diff --git a/content/1.8/cookbook/workingwithmetadata.mdtext 
b/content/1.8/cookbook/workingwithmetadata.mdtext
new file mode 100644
index 0000000..83ca51f
--- /dev/null
+++ b/content/1.8/cookbook/workingwithmetadata.mdtext
@@ -0,0 +1,66 @@
+---
+layout: default
+title: Cookbook - Working with Metadata
+---
+
+# Working with Metadata
+
+## Introduction
+
+PDF documents can contain information describing the document itself or 
certain objects 
+within the document such as the author of the document or it's creation date. 
+Basic information can be set and retrieved using the PDDocumentInformation 
object.
+
+In addition to that more metadata can be retrieved using the XML metadata as 
decribed below.
+Getting basic Metadata
+
+To set or retrieve basic information about the document the 
PDDocumentInformation object 
+provides a high level API to that information:
+
+~~~java
+PDDocumentInformation info = document.getDocumentInformation();
+System.out.println( "Page Count=" + document.getNumberOfPages() );
+System.out.println( "Title=" + info.getTitle() );
+System.out.println( "Author=" + info.getAuthor() );
+System.out.println( "Subject=" + info.getSubject() );
+System.out.println( "Keywords=" + info.getKeywords() );
+System.out.println( "Creator=" + info.getCreator() );
+System.out.println( "Producer=" + info.getProducer() );
+System.out.println( "Creation Date=" + info.getCreationDate() );
+System.out.println( "Modification Date=" + info.getModificationDate());
+System.out.println( "Trapped=" + info.getTrapped() );      
+~~~
+
+## Accessing PDF Metadata
+
+See class:org.apache.pdfbox.pdmodel.common.PDMetadata  
+See example:AddMetadataFromDocInfo  
+See Adobe Documentation:XMP Specification  
+
+PDF documents can have XML metadata associated with certain objects within a 
PDF document.
+For example, the following PD Model objects have the ability to contain 
metadata:
+
+    PDDocumentCatalog
+    PDPage
+    PDXObject
+    PDICCBased
+    PDStream
+
+The metadata that is stored in PDF objects conforms to the XMP specification, 
it is 
+recommended that you review that specification. Currently there is no high 
level API for 
+managing the XML metadata, PDFBox uses standard java InputStream/OutputStream 
to retrieve 
+or set the XML metadata.
+
+~~~java
+PDDocument doc = PDDocument.load( ... );
+PDDocumentCatalog catalog = doc.getDocumentCatalog();
+PDMetadata metadata = catalog.getMetadata();
+
+//to read the XML metadata
+InputStream xmlInputStream = metadata.createInputStream();
+
+//or to write new XML metadata
+InputStream newXMPData = ...;
+PDMetadata newMetadata = new PDMetadata(doc, newXMLData, false );
+catalog.setMetadata( newMetadata );
+~~~
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/1.8/dependencies.mdtext
----------------------------------------------------------------------
diff --git a/content/1.8/dependencies.mdtext b/content/1.8/dependencies.mdtext
new file mode 100644
index 0000000..da3174f
--- /dev/null
+++ b/content/1.8/dependencies.mdtext
@@ -0,0 +1,96 @@
+---
+layout: default
+title:  Dependencies
+---
+
+# Dependencies
+
+PDFBox consists of a three related components and depends on a few external 
libraries. This page describes what these libraries are and how to include them 
in your application.
+
+## Core components
+
+<p class="alert alert-info">These components are needed during runtime, 
development and testing dependent on the details below.</p>
+
+The three PDFBox components are named ```pdfbox```, ```fontbox``` and 
```jempbox```. The Maven groupId of all PDFBox components is org.apache.pdfbox.
+
+### Minimum Requirement
+
+- Java 1.5
+- [commons-logging](http://commons.apache.org/logging/)
+
+The main PDFBox component, pdfbox, has a hard dependency on the 
[commons-logging](http://commons.apache.org/logging/) library.
+Commons Logging is a generic wrapper around different logging frameworks, so 
you'll either need to also use a logging library like 
[log4j](http://logging.apache.org/log4j/)
+or let commons-logging fall back to the standard [java.util.logging 
API](http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/overview.html)
+included in the Java platform.
+
+### Font Handling
+For font handling the fontbox component is needed.
+
+### XMP Metadata 
+To support XMP metadata the jembox component is needed.
+
+To add the pdfbox, fontbox, jempbox and commons-logging jars to your 
application, the easiest thing is to declare the Maven dependency shown below. 
This gives you the main
+pdfbox library directly and the other required jars as transitive dependencies.
+
+    <dependency>
+      <groupId>org.apache.pdfbox</groupId>
+      <artifactId>pdfbox</artifactId>
+      <version>...</version>
+    </dependency>
+
+Set the version field to the latest stable PDFBox version.
+
+## Optional dependencies
+
+Some features in PDFBox depend on optional external libraries. You can enable 
these features simply by including the required libraries in the classpath of 
your application.
+
+### Extented Image Format Support
+
+To support JBIG2 and writing TIFF images additional libraries are needed. 
+
+<p class="alert alert-warning">The image plugins described below are not part 
of the PDFBox distribution because of incompatible licensing terms. Please make 
sure to check if the licensing terms are compatible to your usage.</p>
+
+For **JBIG2** support a Java ImageIO Plugin such as the [Levigo 
Plugin](https://github.com/levigo/jbig2-imageio) or [JBIG2-Image-Decoder
+](https://github.com/Borisvl/JBIG2-Image-Decoder) will be needed. 
+
+To write **TIFF** images a JAI ImageIO Core library will be needed. 
+
+#### PDF Encryption and Signing
+The most notable such optional feature is support for PDF encryption. Instead 
of implementing its own encryption algorithms, PDFBox uses libraries from the 
+[Legion of the Bouncy Castle](http://www.bouncycastle.org/). Both the bcprov 
and bcmail libraries are needed and can be included using the Maven 
dependencies shown below.
+
+    <dependency>
+      <groupId>org.bouncycastle</groupId>
+      <artifactId>bcprov-jdk15</artifactId>
+      <version>1.44</version>
+    </dependency>
+    <dependency>
+      <groupId>org.bouncycastle</groupId>
+      <artifactId>bcmail-jdk15</artifactId>
+      <version>1.44</version>
+    </dependency>
+ 
+<br/>
+
+#### Support for bidirectional languages
+Another important optional feature is support for bidirectional languages like 
Arabic. PDFBox uses the ICU4J library from the 
+[International Components for Unicode](http://site.icu-project.org/) (ICU) 
project to support such languages in PDF documents. To add the ICU4J jar to 
your project, 
+use the following Maven dependency.
+
+    <dependency>
+      <groupId>com.ibm.icu</groupId>
+      <artifactId>icu4j</artifactId>
+      <version>3.8</version>
+    </dependency>
+
+PDFBox also contains extra support for use with the 
[Lucene](http://lucene.apache.org/) and [Ant](http://ant.apache.org/) projects. 
Since in these cases PDFBox is just an
+add-on feature to these projects, you should first set up your application to 
use Lucene or Ant and then add PDFBox support as described on this page.
+
+## Dependencies for Ant builds
+
+The above instructions expect that you're using 
[Maven](http://maven.apache.org/) or another build tool like 
[Ivy](http://ant.apache.org/ivy/) that supports Maven dependencies.
+If you instead use tools like [Ant](http://ant.apache.org/) where you need to 
explicitly include all the required library jars in your application, you'll 
need to do
+something different.
+
+The easiest approach is to run ``mvn dependency:copy-dependencies`` inside the 
pdfbox directory of the latest PDFBox source release. This will copy all the 
required and optional
+libraries discussed above into the pdfbox/target/dependencies directory. You 
can then simply copy all the libraries you need from this directory to your 
application.

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/1.8/faq.mdtext
----------------------------------------------------------------------
diff --git a/content/1.8/faq.mdtext b/content/1.8/faq.mdtext
new file mode 100644
index 0000000..018af6d
--- /dev/null
+++ b/content/1.8/faq.mdtext
@@ -0,0 +1,143 @@
+---
+layout: default
+title:  Frequently Asked Questions (FAQ)
+Notice:    Licensed to the Apache Software Foundation (ASF) under one
+           or more contributor license agreements.  See the NOTICE file
+           distributed with this work for additional information
+           regarding copyright ownership.  The ASF licenses this file
+           to you under the Apache License, Version 2.0 (the
+           "License"); you may not use this file except in compliance
+           with the License.  You may obtain a copy of the License at
+           .
+             http://www.apache.org/licenses/LICENSE-2.0
+           .
+           Unless required by applicable law or agreed to in writing,
+           software distributed under the License is distributed on an
+           "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+           KIND, either express or implied.  See the License for the
+           specific language governing permissions and limitations
+           under the License.
+---
+
+# Frequently asked questions
+
+### General Questions
+
+ - [I am getting the below Log4J warning message, how do I remove it?](#log4j)
+ - [Is PDFBox thread safe?](#threadsafe)
+ - [Why do I get a "Warning: You did not close the PDF Document"?](#notclosed)
+
+### Text Extraction
+
+ - [How come I am not getting any text from the PDF document?](#notext)
+ - [How come I am getting gibberish(G38G43G36G51G5) when extracting 
text?](#gibberish)
+ - [What does "java.io.IOException: Can't handle font width" mean?](#fontwidth)
+ - [Why do I get "You do not have permission to extract text" on some 
documents?](#permission)
+ - [Can't we just extract the text without parsing the whole document or 
extract text as it is parsed?](#partially)
+
+## General Questions
+
+<a name="log4j"></a>
+### I am getting the below Log4J warning message, how do I remove it? ###
+
+```java
+log4j:WARN No appenders could be found for logger 
(org.apache.pdfbox.util.ResourceLoader).
+log4j:WARN Please initialize the log4j system properly.
+```
+
+This message means that you need to configure the log4j logging system.
+See the [log4j documentation](http://logging.apache.org/log4j/1.2/manual.html) 
for more information.
+
+PDFBox comes with a sample log4j configuration file.  To use it you set a 
system property like this
+
+```java
+java -Dlog4j.configuration=log4j.xml org.apache.pdfbox.ExtractText <PDF-file> 
<output-text-file>
+```
+
+If this is not working for you then you may have to specify the log4j config 
file using a URL path, like this:
+
+```java
+log4j.configuration=file:///<path to config file>
+```
+
+Please see 
[this](https://sourceforge.net/forum/forum.php?thread_id=1254229&amp;forum_id=267205)
 forum thread 
+for more information.
+
+<a name="threadsafe"></a>
+### Is PDFBox thread safe? ###
+
+No! Only one thread may access a single document at a time. You can have 
multiple threads
+each accessing their own PDDocument object.
+
+<a name="notclosed"></a>
+### Why do I get a "Warning: You did not close the PDF Document"? ###
+
+You need to call close() on the PDDocument inside the finally block, if you
+don't then the document will not be closed properly.  Also, you must close all
+PDDocument objects that get created.  The following code creates **two**
+PDDocument objects; one from the "new PDDocument()" and the second by the load 
method.
+
+```java
+PDDocument doc = new PDDocument();
+try
+{
+   doc = PDDocument.load( "my.pdf" );
+}
+finally
+{
+   if( doc != null )
+   {
+      doc.close();
+   }
+}
+```
+
+## Text Extraction
+
+<a name="notext"></a>
+### How come I am not getting any text from the PDF document? ###
+
+Text extraction from a pdf document is a complicated task and there are many 
factors
+involved that effect the possibility and accuracy of text extraction.  It 
would be helpful
+to the PDFBox team if you could try a couple things.
+
+ - Open the PDF in Acrobat and try to extract text from there.  If Acrobat can 
extract text then PDFBox 
+should be able to as well and it is a bug if it cannot.  If Acrobat cannot 
extract text then PDFBox 'probably' cannot either.
+ - It might really be an image instead of text.  Some PDF documents are just 
images that have been scanned in.
+You can tell by using the selection tool in Acrobat, if you can't select any 
text then it is probably an image.
+
+<a name="gibberish"></a>
+### How come I am getting gibberish(G38G43G36G51G5) when extracting text? ###
+
+This is because the characters in a PDF document can use a custom encoding
+instead of unicode or ASCII.  When you see gibberish text then it
+probably means that a meaningless internal encoding is being used.  The
+only way to access the text is to use OCR.  This may be a future
+enhancement.
+
+<a name="fontwidth"></a>
+### What does "java.io.IOException: Can't handle font width" mean? ###
+
+This probably means that the "Resources" directory is not in your classpath. 
The
+Resources directory is included in the PDFBox jar so this is only a problem if 
you
+are building PDFBox yourself and not using the binary.
+
+<a name="permission"></a>
+### Why do I get "You do not have permission to extract text" on some 
documents? ###
+
+PDF documents have certain security permissions that can be applied to them 
and two 
+passwords associated with them, a user password and a master password. If the 
"cannot extract text"
+permission bit is set then you need to decrypt the document with the master 
password in order
+to extract the text.
+
+<a name="partially"></a>
+### Can't we just extract the text without parsing the whole document or 
extract text as it is parsed? ###
+
+Not really, for a couple reasons.
+
+ - If the document is encrypted then you need to parse at least until the 
encryption dictionary before 
+you can decrypt.
+ - Sometimes the PDFont contains vital information needed for text extraction.
+ - Text on a page does not have to be drawn in reading order. For example: if 
the page said "Hello World",
+the pdf could have been written such that "World" gets drawn and then the 
cursor moves to the left and 
+the word "Hello" is drawn.

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/2.0/commandline.md
----------------------------------------------------------------------
diff --git a/content/2.0/commandline.md b/content/2.0/commandline.md
new file mode 100644
index 0000000..f30ba33
--- /dev/null
+++ b/content/2.0/commandline.md
@@ -0,0 +1,214 @@
+---
+layout: default
+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.
+
+**Table of Contents**  
+[Decrypt](#decrypt)
+[Encrypt](#encrypt)
+[ExtractText](#extracttext) 
+[OverlayPDF](#overlaypdf)
+[PDFDebugger](#pdfdebugger)
+[PDFMerger](#pdfmerger)
+[PDFSplit](#pdfsplit)
+[PDFToImage](#pdftoimage)
+[PrintPDF](#printpdf)
+[TextToPDF](#texttopdf)
+[WriteDecodedDoc](#writedecodeddoc)
+
+## 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 ##
+
+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 ##
+
+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. |
+
+## 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. 
|
+| outputfile | | The resulting pdf file. |
+
+Examples:
+
+- OverlayPDF input.pdf overlay.pdf output.pdf
+- OverlayPDF input.pdf defaultOverlay.pdf -page 10 overlayForPage10.pdf 
-position foreground output.pdf
+- OverlayPDF input.pdf -odd oddOverlay.pdf -even evenOverlay.pdf output.pdf
+
+## PDFDebugger ##
+
+This application will take an existing PDF document and allows to analyze and 
inspect the internal structure.
+It is used as replacement for the PDFReader which was removed in 2.0.0.
+
+usage: ``java -jar pdfbox-app-2.y.z.jar PDFDebugger [inputfile] ``
+
+| Command Line Parameter | Default | Description |
+| --- | --- | --- |
+| -password | | The password to the PDF document. |
+| -viewstructure | | Activates the "view structure" view on startup. |
+| inputfile | | the name of an optional PDF file to open. |
+
+## 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>``
+
+## 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. |
+
+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 ##
+
+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. |
+
+## 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 ##
+
+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 ##
+
+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. |
+| <input-file> |  | The PDF file to decompress |
+| <output-file> |  | The destination PDF file |
+

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/2.0/cookbook/encryption.md
----------------------------------------------------------------------
diff --git a/content/2.0/cookbook/encryption.md 
b/content/2.0/cookbook/encryption.md
new file mode 100644
index 0000000..607e52b
--- /dev/null
+++ b/content/2.0/cookbook/encryption.md
@@ -0,0 +1,53 @@
+---
+layout: default
+license: Licensed to the Apache Software Foundation (ASF) under one
+         or more contributor license agreements.  See the NOTICE file
+         distributed with this work for additional information
+         regarding copyright ownership.  The ASF licenses this file
+         to you under the Apache License, Version 2.0 (the
+         "License"); you may not use this file except in compliance
+         with the License.  You may obtain a copy of the License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+         Unless required by applicable law or agreed to in writing,
+         software distributed under the License is distributed on an
+         "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+         KIND, either express or implied.  See the License for the
+         specific language governing permissions and limitations
+         under the License.
+         
+title: Cookbook - Encrypting a file
+---
+
+Encrypting a file
+=================
+
+PDF encryption requires two passwords: the "user password" to open and view 
the file with restricted permissions, the "owner password" to access the file 
with all permission.
+
+
+Load and save encrypted
+-----------------------
+
+This small sample shows how to encrypt a file so that it can be viewed, but 
not printed..
+
+    PDDocument doc = PDDocument.load("filename.pdf");
+
+    // Define the length of the encryption key.
+    // Possible values are 40, 128 or 256.
+    int keyLength = 256;
+    
+    AccessPermission ap = new AccessPermission();
+        
+    // disable printing, everything else is allowed
+    ap.setCanPrint(false);
+        
+    // owner password (to open the file with all permissions) is "12345"
+    // user password (to open the file but with restricted permissions, is 
empty here) 
+    StandardProtectionPolicy spp = new StandardProtectionPolicy("12345", "", 
ap);
+    spp.setEncryptionKeyLength(keyLength);
+    spp.setPermissions(ap);
+    doc.protect(spp);
+        
+    doc.save("filename-encrypted.pdf");
+    doc.close();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/2.0/dependencies.mdtext
----------------------------------------------------------------------
diff --git a/content/2.0/dependencies.mdtext b/content/2.0/dependencies.mdtext
new file mode 100644
index 0000000..3a212d3
--- /dev/null
+++ b/content/2.0/dependencies.mdtext
@@ -0,0 +1,56 @@
+---
+layout: default
+title:  Dependencies
+---
+
+<p class="alert alert-warning">This is an unreleased development preview and 
may change without notice.</p>
+
+# Dependencies
+
+PDFBox has the following basic dependencies:
+
+- Java 6
+- [commons-logging](http://commons.apache.org/logging/)
+
+Commons Logging is a generic wrapper around different logging frameworks, so 
you'll either need to also use a logging library like 
[log4j](http://logging.apache.org/log4j/)
+or let commons-logging fall back to the standard [java.util.logging 
API](http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/overview.html)
+included in the Java platform.
+
+## Optional components
+
+PDFBox does not ship with all features enabled. Third party compoenets are 
necessary to get full support for certain functionality.
+
+### JAI Image I/O
+
+PDF supports embedded image files, however support for some formats require 
third party libraries which are distributed under terms incompatible with the 
Apache 2.0 license:
+
+- Reading **JBIG2** images: [JBIG2 
ImageIO](https://github.com/levigo/jbig2-imageio) or [JBIG2-Image-Decoder
+](https://github.com/Borisvl/JBIG2-Image-Decoder)
+- Reading **JPEG 2000 (JPX)** images: [JAI Image I/O Tools 
Core](https://java.net/projects/jai-imageio-core)
+- Writing **TIFF** images requires *JAI Image I/O Tools Core* also.
+
+These libraries are optional and will be loaded if present on the classpath, 
otherwise support for these image formats will be disable and a warning will be 
logged when an unsupported image is encountered.
+
+Maven dependencies for these components can be found in 
[parent/pom.xml](https://svn.apache.org/viewvc/pdfbox/trunk/parent/pom.xml?view=markup).
 Please make sure that any third party licenses are suitable for your project.
+
+### Encryption and Signing
+
+Encrypting and sigining PDFs requires the *bcprov* and *bcmail* libraries from 
the [Legion of the Bouncy Castle](http://www.bouncycastle.org/). These can be 
included in your Maven project using the following dependencies:
+
+    <dependency>
+        <groupId>org.bouncycastle</groupId>
+        <artifactId>bcprov-jdk15on</artifactId>
+        <version>1.53</version>
+    </dependency>
+    
+    <dependency>
+        <groupId>org.bouncycastle</groupId>
+        <artifactId>bcmail-jdk15on</artifactId>
+        <version>1.53</version>
+    </dependency>
+
+### Java Cryptography Extension (JCE)
+
+256-bit AES encryption requires a JDK with "unlimited strength" cryptography, 
which requires extra files to be installed. For JDK 7, see [Java Cryptography 
Extension 
(JCE)](http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html).
 If these files are not installed, building PDFBox will throw an exception with 
the following message:
+
+    JCE unlimited strength jurisdiction policy files are not installed

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/2.0/examples.mdtext
----------------------------------------------------------------------
diff --git a/content/2.0/examples.mdtext b/content/2.0/examples.mdtext
new file mode 100644
index 0000000..cdd8be8
--- /dev/null
+++ b/content/2.0/examples.mdtext
@@ -0,0 +1,9 @@
+---
+layout: default
+title:  Examples
+---
+<p class="alert alert-warning">This is an unreleased development preview and 
may change without notice.</p>
+
+# Examples
+
+This content is under construction. Please look at our 
[examples](https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/)
 directory in SVN.

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/2.0/getting-started.mdtext
----------------------------------------------------------------------
diff --git a/content/2.0/getting-started.mdtext 
b/content/2.0/getting-started.mdtext
new file mode 100644
index 0000000..a4ecc14
--- /dev/null
+++ b/content/2.0/getting-started.mdtext
@@ -0,0 +1,33 @@
+---
+layout: default
+title:  Getting Started
+---
+
+<p class="alert alert-warning">This is an unreleased development preview and 
may change without notice.</p>
+
+# Getting Started
+
+This content is under construction.
+
+## Maven
+
+To use the latest 2.0 snapshot release from the SVN trunk, you'll need to add 
the following dependency:
+
+    <dependency>
+      <groupId>org.apache.pdfbox</groupId>
+      <artifactId>pdfbox</artifactId>
+      <version>2.0.0-SNAPSHOT</version>
+    </dependency>
+
+You'll also need to add the following repository:
+
+    <repository>
+      <id>ApacheSnapshot</id>
+      <name>Apache Repository</name>
+      <url>https://repository.apache.org/content/groups/snapshots/</url>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </repository>
+
+Please note that this will use the latest **unstable** development snapshot.

http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/78a43732/content/2.0/migration.md
----------------------------------------------------------------------
diff --git a/content/2.0/migration.md b/content/2.0/migration.md
new file mode 100644
index 0000000..cd3260f
--- /dev/null
+++ b/content/2.0/migration.md
@@ -0,0 +1,160 @@
+---
+layout: default
+title:  PDFBox 2.0.0 Migration Guide 
+---
+
+# Migration to PDFBox 2.0.0
+
+## Environment
+PDFBox 2.0.0 requires at least Java 6
+ 
+## Packages
+There are some significant changes to the package structure of PDFBox:
+
+- Jempbox is no longer supported and was removed in favour of Xmpbox
+- all examples were moved to the new package "pdfbox-examples"
+- all commandline tools were moved to the new package "pdfbox-tools"
+- all debugger related stuff was moved to the new package "pdfbox-debugger"
+- the new package "debugger-app" provides a standalone pre built binary for 
the debugger
+
+## Dependency updates
+All libraries on which PDFBox depends are updated to their latest stable 
versions:
+
+- Bouncy Castle 1.53
+- Apache Commons Logging 1.2
+
+For test support the libraries are updated to
+
+- JUnit 4.12
+- JAI Image Core 1.2
+- Levigo JBIG ImageIO Plugin 1.6.3
+
+## Breaking Changes to the Library
+
+### Deprecated API calls
+Most deprecated API calls in PDFBox 1.8.x have been removed for PDFBox 2.0.0 
+
+### API Changes
+The API changes are reflected in the Javadoc for PDFBox 2.0.0. The most 
notable changes are:
+
+- `getCOSDictionary()` is no longer used. Instead `getCOSObject` now returns 
the matching `COSBase` subtype.
+- `PDXObjectForm` was renamed to `PDFormXObject` to be more in line with the 
PDF specification.
+- `PDXObjectImage` was renamed to `PDImageXObject` to be more in line with the 
PDF specification.
+- `PDPage.getContents().createInputStream()`was simplified to 
`PDPage.getContents()`.
+
+### General Behaviour
+PDFBox 2.0.0 is now parsing PDF files following the Xref information in the 
PDF. This is similar to the functionality using
+`PDDocument.loadNonSeq` with PDFBox 1.8.x. Users still using `PDDocument.load` 
with PDFBox 1.8.x might experience different
+results when switching to PDFBox 2.0.0.
+
+### Font Handling
+Font handling now has full Unicode support and supports font subsetting.
+
+TrueType fonts shall now be loaded using
+
+~~~java
+PDType0Font.load
+~~~
+
+to leverage that. 
+
+### PDF Resources Handling
+The individual calls to add resources such as `PDResource.addFont(PDFont 
font)` and `PDResource.addXObject(PDXObject xobject, String prefix)`
+have been replaced with `PDResource.add(resource type)` where `resource type` 
represents the different resource classes such as `PDFont`, `PDAbstractPattern`
+and so on. The `add` method now supports all the different type of resources 
available.
+
+### Working with Images
+The individual classes `PDJpeg()`, `PDPixelMap()` and `PDCCitt()` to import 
images have been replaced with `PDImageXObject.createFromFile` which works for 
JPG, TIFF (only G4 compression), PNG, BMP and GIF.
+
+In addition there are some specialized classes:
+
+- `JPEGFactory.createFromStream` which preserve the JPEG data and embed it in 
the PDF file without modification. (This is best if you have a JPEG file).
+- `CCITTFactory.createFromFile` (for bitonal TIFF images with G4 compression).
+- `LosslessFactory.createFromImage` (this is best if you start with a 
BufferedImage).
+
+### Iterating Pages
+With PDFBox 2.0.0 the prefered way to iterate through the pages of a document 
is
+
+~~~java
+for(PDPage page : document.getPages())
+{
+    ... (do something)
+}
+~~~
+
+### PDF Rendering
+With PDFBox 2.0.0 `PDPage.convertToImage`has been removed. Instead the new 
`PDFRenderer` class shall be used.
+
+~~~java
+PDDocument document = PDDocument.load(new File(pdfFilename));
+PDFRenderer pdfRenderer = new PDFRenderer(document);
+int pageCounter = 0;
+for (PDPage page : document.getPages())
+{ 
+    pdfRenderer.renderImageWithDPI(pageCounter, 300, ImageType.RGB);
+
+    // suffix in filename will be used as the file format
+    ImageIOUtil.writeImage(bim, pdfFilename + "-" + (pageCounter++) + ".png", 
300);
+}
+document.close();
+~~~
+
+### PDF Printing
+With PDFBox 2.0.0 `PDFPrinter` has been removed.
+
+Users of `PDFPrinter.silentPrint()` should now use this code:
+
+~~~java
+PrinterJob job = PrinterJob.getPrinterJob();
+job.setPageable(new PDFPageable(document));
+job.print();
+~~~
+
+While users of `PDFPrinter.print()` should now use this code:
+
+~~~java
+PrinterJob job = PrinterJob.getPrinterJob();
+job.setPageable(new PDFPageable(document));
+if (job.printDialog()) {
+    job.print();
+}
+~~~
+
+Advanced use case examples can be found in th examples package under 
org/apache/pdfbox/examples/printing/Printing.java
+
+### Text Extraction
+In 1.8, to get the text colors, one method was to pass an expanded .properties 
file to the PDFStripper constructor. To achieve the same 
+in PDFBox 2.0 you can extend ``PDFTextStripper``and add the following 
``Operators`` to the constructor:
+
+~~~java
+addOperator(new SetStrokingColorSpace());
+addOperator(new SetNonStrokingColorSpace());
+addOperator(new SetStrokingDeviceCMYKColor());
+addOperator(new SetNonStrokingDeviceCMYKColor());
+addOperator(new SetNonStrokingDeviceRGBColor());
+addOperator(new SetStrokingDeviceRGBColor());
+addOperator(new SetNonStrokingDeviceGrayColor());
+addOperator(new SetStrokingDeviceGrayColor());
+addOperator(new SetStrokingColor());
+addOperator(new SetStrokingColorN());
+addOperator(new SetNonStrokingColor());
+addOperator(new SetNonStrokingColorN());
+~~~
+
+### Interactive Forms
+Large parts of the support for interactive forms (AcroForms) has been 
rewritten. The most notable change from 1.8.x is that
+there is a clear distinction between fields and the annotations representing 
them visually. Intermediate nodes in a field 
+tree are now represented by the `PDNonTerminalField` class.
+
+With PDFBox 2.0.0 the prefered way to iterate through the fields is now
+
+~~~java
+PDAcroForm form;
+...
+for (PDField field : form.getFieldTree())
+{
+    ... (do something)
+}
+~~~
+
+Most `PDField` subclasses now accept Java generic types such as `String` as 
parameters instead of the former `COSBase` subclasses.
\ No newline at end of file

Reply via email to