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/10/30 12:05:39 UTC
pdfbox-docs git commit: PDFBOX-3040: move existing additional content
Repository: pdfbox-docs
Updated Branches:
refs/heads/master 78a43732d -> f7b7ad608
PDFBOX-3040: move existing additional content
Project: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/commit/f7b7ad60
Tree: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/tree/f7b7ad60
Diff: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/diff/f7b7ad60
Branch: refs/heads/master
Commit: f7b7ad608226eba7337f9f780d60c9a7c1ae5876
Parents: 78a4373
Author: Maruan Sahyoun <sa...@fileaffairs.de>
Authored: Fri Oct 30 12:05:06 2015 +0100
Committer: Maruan Sahyoun <sa...@fileaffairs.de>
Committed: Fri Oct 30 12:05:06 2015 +0100
----------------------------------------------------------------------
content/1.8/cookbook/fill-form-field.md | 68 +++++++++++++++++++++
content/1.8/cookbook/rendering.md | 63 +++++++++++++++++++
docs/1.8/cookbook/acroforms/fill-form-field.md | 68 ---------------------
docs/1.8/cookbook/rendering/rendering.md | 63 -------------------
4 files changed, 131 insertions(+), 131 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/f7b7ad60/content/1.8/cookbook/fill-form-field.md
----------------------------------------------------------------------
diff --git a/content/1.8/cookbook/fill-form-field.md b/content/1.8/cookbook/fill-form-field.md
new file mode 100644
index 0000000..80aac9b
--- /dev/null
+++ b/content/1.8/cookbook/fill-form-field.md
@@ -0,0 +1,68 @@
+---
+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 - Fill a Form Field
+---
+
+Fill a Form Field
+==================
+
+Form fields within a PDF are defined as part of the AcroForm entry within the PDF's document catalog.
+Form there individual fields can be accessed. Fields might be organized in a tree structure so it might
+be neccessary to walk through the tree to get an individual field.
+
+Load the PDF document.
+
+ :::java
+ // load the document
+ PDDocument pdfDocument = PDDocument.loadNonSeq(new File(... ), null);
+
+Get the docoument catalog and the AcroForm which might be contained within.
+
+ :::java
+ // get the document catalog
+ PDDocumentCatalog docCatalog = pdfDocument.getDocumentCatalog();
+ PDAcroForm acroForm = docCatalog.getAcroForm();
+
+Retrieve an individual field and set its value.
+
+ :::java
+ // as there might not be an AcroForm entry a null check is necessary
+ if (acroForm != null)
+ {
+ PDField field = (PDField) acroForm.getField( "fieldName" );
+ field.setValue("new field value");
+ }
+
+If a field is nested within the form tree a fully qualified name might be provided
+to access the field.
+
+ :::java
+ // as there might not be an AcroForm entry a null check is neccessary
+ if (acroForm != null)
+ {
+ PDField field = (PDField) acroForm.getField( "fieldsParentName.fieldName" );
+ field.setValue("new field value");
+ }
+
+Save and close the filled out form.
+
+ :::java
+ doc.save(filledForm);
+ doc.close();
+
http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/f7b7ad60/content/1.8/cookbook/rendering.md
----------------------------------------------------------------------
diff --git a/content/1.8/cookbook/rendering.md b/content/1.8/cookbook/rendering.md
new file mode 100644
index 0000000..29e3714
--- /dev/null
+++ b/content/1.8/cookbook/rendering.md
@@ -0,0 +1,63 @@
+---
+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 - Rendering
+---
+
+Document Rendering
+==================
+
+Convert a document to images
+----------------------------
+
+This small sample shows how to render (convert to images) a PDF document using PDFBox.
+
+ :::java
+ String filename = "YOURFILENAMEHERE.pdf";
+
+ // open the document
+ PDDocument doc = PDDocument.loadNonSeq(new File(filename), null);
+
+ boolean b;
+ List<PDPage> pages = doc.getDocumentCatalog().getAllPages();
+ for (int p = 0; p < pages.size(); ++p)
+ {
+ // RGB image with 300 dpi
+ BufferedImage bim = pages.get(p).convertToImage(BufferedImage.TYPE_INT_RGB, 300);
+
+ // save as PNG with default metadata
+ b = ImageIO.write(bim, "png", new File("rgbpage" + (p+1) + ".png"));
+ if (!b)
+ {
+ // error handling
+ }
+
+ // B/W image with 300 dpi
+ bim = pages.get(p).convertToImage(BufferedImage.TYPE_BYTE_BINARY, 300);
+
+ // save as TIF with dpi in the metadata
+ // PDFBox will choose the best compression for you - here: CCITT G4
+ // you need to add jai_imageio.jar to your classpath for this to work
+ b = ImageIOUtil.writeImage(bim, "bwpage-" + (p+1) + ".tif", 300);
+ if (!b)
+ {
+ // error handling
+ }
+ }
+
+ doc.close();
http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/f7b7ad60/docs/1.8/cookbook/acroforms/fill-form-field.md
----------------------------------------------------------------------
diff --git a/docs/1.8/cookbook/acroforms/fill-form-field.md b/docs/1.8/cookbook/acroforms/fill-form-field.md
deleted file mode 100644
index 80aac9b..0000000
--- a/docs/1.8/cookbook/acroforms/fill-form-field.md
+++ /dev/null
@@ -1,68 +0,0 @@
----
-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 - Fill a Form Field
----
-
-Fill a Form Field
-==================
-
-Form fields within a PDF are defined as part of the AcroForm entry within the PDF's document catalog.
-Form there individual fields can be accessed. Fields might be organized in a tree structure so it might
-be neccessary to walk through the tree to get an individual field.
-
-Load the PDF document.
-
- :::java
- // load the document
- PDDocument pdfDocument = PDDocument.loadNonSeq(new File(... ), null);
-
-Get the docoument catalog and the AcroForm which might be contained within.
-
- :::java
- // get the document catalog
- PDDocumentCatalog docCatalog = pdfDocument.getDocumentCatalog();
- PDAcroForm acroForm = docCatalog.getAcroForm();
-
-Retrieve an individual field and set its value.
-
- :::java
- // as there might not be an AcroForm entry a null check is necessary
- if (acroForm != null)
- {
- PDField field = (PDField) acroForm.getField( "fieldName" );
- field.setValue("new field value");
- }
-
-If a field is nested within the form tree a fully qualified name might be provided
-to access the field.
-
- :::java
- // as there might not be an AcroForm entry a null check is neccessary
- if (acroForm != null)
- {
- PDField field = (PDField) acroForm.getField( "fieldsParentName.fieldName" );
- field.setValue("new field value");
- }
-
-Save and close the filled out form.
-
- :::java
- doc.save(filledForm);
- doc.close();
-
http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/f7b7ad60/docs/1.8/cookbook/rendering/rendering.md
----------------------------------------------------------------------
diff --git a/docs/1.8/cookbook/rendering/rendering.md b/docs/1.8/cookbook/rendering/rendering.md
deleted file mode 100644
index 29e3714..0000000
--- a/docs/1.8/cookbook/rendering/rendering.md
+++ /dev/null
@@ -1,63 +0,0 @@
----
-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 - Rendering
----
-
-Document Rendering
-==================
-
-Convert a document to images
-----------------------------
-
-This small sample shows how to render (convert to images) a PDF document using PDFBox.
-
- :::java
- String filename = "YOURFILENAMEHERE.pdf";
-
- // open the document
- PDDocument doc = PDDocument.loadNonSeq(new File(filename), null);
-
- boolean b;
- List<PDPage> pages = doc.getDocumentCatalog().getAllPages();
- for (int p = 0; p < pages.size(); ++p)
- {
- // RGB image with 300 dpi
- BufferedImage bim = pages.get(p).convertToImage(BufferedImage.TYPE_INT_RGB, 300);
-
- // save as PNG with default metadata
- b = ImageIO.write(bim, "png", new File("rgbpage" + (p+1) + ".png"));
- if (!b)
- {
- // error handling
- }
-
- // B/W image with 300 dpi
- bim = pages.get(p).convertToImage(BufferedImage.TYPE_BYTE_BINARY, 300);
-
- // save as TIF with dpi in the metadata
- // PDFBox will choose the best compression for you - here: CCITT G4
- // you need to add jai_imageio.jar to your classpath for this to work
- b = ImageIOUtil.writeImage(bim, "bwpage-" + (p+1) + ".tif", 300);
- if (!b)
- {
- // error handling
- }
- }
-
- doc.close();