pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r889537 - in /websites/staging/pdfbox/trunk/content: ./ cookbook/pdfacreation.html
Date Sun, 08 Dec 2013 09:07:46 GMT
Author: buildbot
Date: Sun Dec  8 09:07:45 2013
New Revision: 889537

Log:
Staging update by buildbot for pdfbox

Added:
    websites/staging/pdfbox/trunk/content/cookbook/pdfacreation.html
Modified:
    websites/staging/pdfbox/trunk/content/   (props changed)

Propchange: websites/staging/pdfbox/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sun Dec  8 09:07:45 2013
@@ -1 +1 @@
-1547771
+1549011

Added: websites/staging/pdfbox/trunk/content/cookbook/pdfacreation.html
==============================================================================
--- websites/staging/pdfbox/trunk/content/cookbook/pdfacreation.html (added)
+++ websites/staging/pdfbox/trunk/content/cookbook/pdfacreation.html Sun Dec  8 09:07:45 2013
@@ -0,0 +1,215 @@
+<!DOCTYPE html>
+<html lang="en">
+    
+    <!--
+     
+     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.
+     -->
+    
+  <head>
+    <title>Apache PDFBox | Create a valid PDF/A document</title>
+
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+
+    <link href="/bootstrap/css/bootstrap.css" rel="stylesheet">
+    <link href="/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
+    <link href="/FontAwesome/css/font-awesome.css" rel="stylesheet">
+    <link href="/Iconic/iconic fill/iconic_fill.css" rel="stylesheet">
+    <link href="/css/pygments-github.css" rel="stylesheet">
+    <link href="/css/site.css" rel="stylesheet">
+        
+        
+
+    
+
+    
+    <!-- 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 &quot;License&quot;); 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 &quot;AS IS&quot; 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. -->
+        <!-- Twitter Bootstrap and jQuery after this line. -->
+        <script src="http://code.jquery.com/jquery-latest.js"></script>
+        <script src="/bootstrap/js/bootstrap.js"></script>
+        <script>
+            $('.nav-collapse').collapse();
+        </script>
+  </head>
+  <body>
+
+    <div class="navbar navbar-fixed-top">
+      <div class="navbar-inner">
+          <a href="/index.html"><img class="logo" src="/images/logo-head.gif"></a>
+      </div>
+    </div>
+
+    <header class="main" id="overview">
+        <div class="container">
+        </div>
+    </header>
+
+    <div class="container-fluid">
+        <div class="row-fluid">
+            <div class="span3">
+                <ul class="nav nav-list">
+                    <li class="nav-header">Apache PDFBox</li>
+                    <li><a href="/downloads.html">
+                        <i class="icon-chevron-right"></i>
+                    Downloads</a></li>
+                    <li><a href="/dependencies.html">
+                        <i class="icon-chevron-right"></i>
+                    Dependencies</a></li>
+                    <li><a href="/references.html">
+                        <i class="icon-chevron-right"></i>
+                        References</a></li>
+                <li class="nav-header">Community</li>
+                <li><a href="/support.html">
+                    <i class="icon-chevron-right"></i>
+                    Support
+                </a></li>
+                <li><a href="/mailinglists.html">
+                    <i class="icon-chevron-right"></i>
+                    Mailing Lists
+                </a></li>
+                <li><a href="/team.html">
+                    <i class="icon-chevron-right"></i>
+                    Project Team</a></li>
+                <li  class="nav-header">Documentation</li>
+                <li><a href="/architecture.html">
+                    <i class="icon-chevron-right"></i>
+                    Architecture</a></li>
+                <li><a href="/commandline/">
+                    <i class="icon-chevron-right"></i>
+                    Command Line Tools</a></li>
+                <li class="dropdown"><a  class="dropdown-toggle" data-toggle="dropdown"
href="#">
+                    <i class="icon-chevron-right"></i>
+                    PDFBox Cookbook <b class="caret"></b></a>
+                    <ul class="dropdown-menu">
+                        <li><a href="/cookbook/documentcreation.html">
+                            <i class="icon-chevron-right"></i>
+                            Document Creation</a>
+                        </li>
+                        <li><a href="/cookbook/textextraction.html">
+                            <i class="icon-chevron-right"></i>
+                            Text Extraction</a>
+                        </li>
+                        <li><a href="/cookbook/pdfavalidation.html">
+                            <i class="icon-chevron-right"></i>
+                            PDF/A Validation</a>
+                        </li>
+                        <li><a href="/cookbook/workingwithfonts.html">
+                            <i class="icon-chevron-right"></i>
+                            Working with Fonts</a>
+                        </li>
+                        <li><a href="/cookbook/workingwithmetadata.html">
+                            <i class="icon-chevron-right"></i>
+                            Working with Metadata</a>
+                        </li>
+                        <li><a href="/cookbook/workingwithattachments.html">
+                            <i class="icon-chevron-right"></i>
+                            Working with Attachments</a>
+                        </li>
+                    </ul>
+                </li>
+                <li><a href="/apidocs/">
+                    <i class="icon-chevron-right"></i>
+                    API Docs</a></li>
+                <li  class="nav-header">For Developers</li>
+					<li><a href="/userguide/faq.html">
+                    <i class="icon-chevron-right"></i>
+                    FAQ</a></li>
+                <li><a href="/building.html">
+                    <i class="icon-chevron-right"></i>
+                    Building PDFBox</a></li>
+                <li><a href="/ideas.html">
+                    <i class="icon-chevron-right"></i>
+                    Ideas</a></li>
+                <li><a href="/codingconventions.html">
+                    <i class="icon-chevron-right"></i>
+                    Coding Conventions</a></li>
+                <li  class="nav-header">Apache Software Foundation</li>
+                <li><a href="http://www.apache.org/">
+                    <i class="icon-chevron-right"></i>
+                    Apache Software Foundation</a></li>
+                <li><a href="http://www.apache.org/foundation/thanks.html">
+                    <i class="icon-chevron-right"></i>
+                    ASF Sponsors</a></li>
+                <li><a href="http://www.apache.org/security/">
+                    <i class="icon-chevron-right"></i>
+                    Security</a></li>
+                </ul>
+            </div>
+            <div class="span9">
+                 <h2 id="pdfa-creation">PDF/A Creation</h2>
+<p>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.</p>
+<p>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.</p>
+<h3 id="load-all-the-fonts-used-in-document">Load all the fonts used in document</h3>
+<p>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:</p>
+<div class="codehilite"><pre><span class="n">InputStream</span> <span
class="n">fontStream</span> <span class="o">=</span> <span class="n">CreatePDFA</span><span
class="o">.</span><span class="na">class</span><span class="o">.</span><span
class="na">getResourceAsStream</span><span class="o">(</span><span
class="s">&quot;/org/apache/pdfbox/resources/ttf/ArialMT.ttf&quot;</span><span
class="o">);</span>
+<span class="n">PDFont</span> <span class="n">font</span> <span
class="o">=</span> <span class="n">PDTrueTypeFont</span><span class="o">.</span><span
class="na">loadTTF</span><span class="o">(</span><span class="n">doc</span><span
class="o">,</span> <span class="n">fontStream</span><span class="o">);</span>
+</pre></div>
+
+
+<h3 id="including-xmp-metadata-block">Including XMP metadata block</h3>
+<p>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:</p>
+<div class="codehilite"><pre><span class="n">XMPMetadata</span> <span
class="n">xmp</span> <span class="o">=</span> <span class="k">new</span>
<span class="n">XMPMetadata</span><span class="o">();</span>
+<span class="n">XMPSchemaPDFAId</span> <span class="n">pdfaid</span>
<span class="o">=</span> <span class="k">new</span> <span class="n">XMPSchemaPDFAId</span><span
class="o">(</span><span class="n">xmp</span><span class="o">);</span>
+<span class="n">xmp</span><span class="o">.</span><span class="na">addSchema</span><span
class="o">(</span><span class="n">pdfaid</span><span class="o">);</span>
+<span class="n">pdfaid</span><span class="o">.</span><span class="na">setConformance</span><span
class="o">(</span><span class="s">&quot;B&quot;</span><span
class="o">);</span>
+<span class="n">pdfaid</span><span class="o">.</span><span class="na">setPart</span><span
class="o">(</span><span class="mi">1</span><span class="o">);</span>
+<span class="n">pdfaid</span><span class="o">.</span><span class="na">setAbout</span><span
class="o">(</span><span class="s">&quot;&quot;</span><span
class="o">);</span>
+<span class="n">metadata</span><span class="o">.</span><span class="na">importXMPMetadata</span><span
class="o">(</span><span class="n">xmp</span><span class="o">);</span>
+</pre></div>
+
+
+<h3 id="including-color-profile">Including color profile</h3>
+<p>It is mandatory to include the color profile used by the document. Different profiles
can be used. This 
+example takes one present in pdfbox:</p>
+<div class="codehilite"><pre><span class="c1">// create output intent</span>
+<span class="n">InputStream</span> <span class="n">colorProfile</span>
<span class="o">=</span> <span class="n">CreatePDFA</span><span
class="o">.</span><span class="na">class</span><span class="o">.</span><span
class="na">getResourceAsStream</span><span class="o">(</span><span
class="s">&quot;/org/apache/pdfbox/resources/pdfa/sRGB Color Space Profile.icm&quot;</span><span
class="o">);</span>
+<span class="n">PDOutputIntent</span> <span class="n">oi</span> <span
class="o">=</span> <span class="k">new</span> <span class="n">PDOutputIntent</span><span
class="o">(</span><span class="n">doc</span><span class="o">,</span>
<span class="n">colorProfile</span><span class="o">);</span> 
+<span class="n">oi</span><span class="o">.</span><span class="na">setInfo</span><span
class="o">(</span><span class="s">&quot;sRGB IEC61966-2.1&quot;</span><span
class="o">);</span> 
+<span class="n">oi</span><span class="o">.</span><span class="na">setOutputCondition</span><span
class="o">(</span><span class="s">&quot;sRGB IEC61966-2.1&quot;</span><span
class="o">);</span> 
+<span class="n">oi</span><span class="o">.</span><span class="na">setOutputConditionIdentifier</span><span
class="o">(</span><span class="s">&quot;sRGB IEC61966-2.1&quot;</span><span
class="o">);</span> 
+<span class="n">oi</span><span class="o">.</span><span class="na">setRegistryName</span><span
class="o">(</span><span class="s">&quot;http://www.color.org&quot;</span><span
class="o">);</span> 
+<span class="n">cat</span><span class="o">.</span><span class="na">addOutputIntent</span><span
class="o">(</span><span class="n">oi</span><span class="o">);</span>
+</pre></div>
+
+
+<h3 id="complete-example">Complete example</h3>
+<p>The complete example can be found in pdfbox-example. The source file is</p>
+<div class="codehilite"><pre><span class="n">src</span><span class="o">/</span><span
class="n">main</span><span class="o">/</span><span class="n">java</span><span
class="o">/</span><span class="n">org</span><span class="o">/</span><span
class="n">apache</span><span class="o">/</span><span class="n">pdfbox</span><span
class="o">/</span><span class="n">examples</span><span class="o">/</span><span
class="n">pdfa</span><span class="o">/</span><span class="n">CreatePDFA</span><span
class="p">.</span><span class="n">java</span>
+</pre></div> 
+            </div>
+        </div>
+    </div>
+
+      <footer id="copyright">
+          <div class="row-fluid">
+              <div class="span3">
+                  <!-- nothing in here on purpose -->
+              </div>
+              
+              <div class="span9">
+                  <p>Copyright © 2013 <a href="http://www.apache.org/">The
Apache Software Foundation</a>, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache
License, Version 2.0</a>. <br/>
+                  Apache PDFBox, PDFBox, Apache, the Apache feather logo and the Apache PDFBox
project logos are trademarks of The Apache Software Foundation.</p>
+              </div>
+          </div>
+      </footer>
+      
+  </body>
+</html>



Mime
View raw message