You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by gi...@apache.org on 2024/02/07 11:06:51 UTC
(xmlgraphics-website) branch asf-site updated: Automatic Site Publish by Buildbot
This is an automated email from the ASF dual-hosted git repository.
git-site-role pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/xmlgraphics-website.git
The following commit(s) were added to refs/heads/asf-site by this push:
new 0ff54061 Automatic Site Publish by Buildbot
0ff54061 is described below
commit 0ff54061ac6597c7aed056267bb5e481fcc95b48
Author: buildbot <us...@infra.apache.org>
AuthorDate: Wed Feb 7 11:06:49 2024 +0000
Automatic Site Publish by Buildbot
---
output/fop/trunk/output.html | 4 ++--
output/fop/trunk/pdfencryption.html | 44 ++++++++++++++++++++++++++++++++-----
2 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/output/fop/trunk/output.html b/output/fop/trunk/output.html
index d93e7fed..01efb976 100644
--- a/output/fop/trunk/output.html
+++ b/output/fop/trunk/output.html
@@ -1656,8 +1656,8 @@ h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover
<p>PDF has a set of fonts that are always available to all PDF viewers; to quote from the PDF Specification:</p>
<p><em>"PDF prescribes a set of 14 standard fonts that can be used without prior definition. These include four faces each of three Latin text typefaces (Courier, Helvetica, and Times), as well as two symbolic fonts (Symbol and ITC Zapf Dingbats). These fonts, or suitable substitute fonts with the same metrics, are guaranteed to be available in all PDF viewer applications."</em></p>
<h3 id="pdf-postprocess">Post-processing</h3>
-<p>FOP does not currently support several desirable PDF features: watermarks and signatures. One workaround is to use Adobe Acrobat (the full version, not the Reader) to process the file manually or with scripting that it supports.</p>
-<p>Another popular post-processing tool is <a href="http://itextpdf.com/">iText</a>, which has tools for adding security features, document properties, watermarks, and many other features to PDF files.
+<p>FOP does not currently support several desirable PDF features: watermarks. One workaround is to use Adobe Acrobat (the full version, not the Reader) to process the file manually or with scripting that it supports.</p>
+<p>Another popular post-processing tool is <a href="http://itextpdf.com/">iText</a>, which has tools for adding watermarks, and many other features to PDF files.
<warning>Caveat: iText may swallow PDF bookmarks. But Jens Stavnstrup tells us in issue <a href="https://issues.apache.org/jira/browse/FOP-1100">FOP-1100</a> that this doesn't happen if you use iText's PDFStamper.</warning>
Here is some sample code that uses iText to encrypt a FOP-generated PDF. (Note that FOP now supports <a href="pdfencryption.html">PDF encryption</a>. However the principles for using iText for other PDF features are similar.)</p>
<div class="highlight"><pre><span></span><code><span class="kd">public</span> <span class="kd">static</span> <span class="kt">void</span> <span class="nf">main</span><span class="p">(</span><span class="n">String</span> <span class="n">args</span><span class="o">[]</span><span class="p">)</span> <span class="p">{</span>
diff --git a/output/fop/trunk/pdfencryption.html b/output/fop/trunk/pdfencryption.html
index 2cd6abd8..a87dfba6 100644
--- a/output/fop/trunk/pdfencryption.html
+++ b/output/fop/trunk/pdfencryption.html
@@ -25,7 +25,7 @@
});
</script>
- <title>Apache(tm) FOP: PDF encryption.</title>
+ <title>Apache(tm) FOP: PDF signing and encryption.</title>
</head>
<body>
@@ -1602,12 +1602,46 @@ $(document).ready(function () {
visibility: hidden;
}
h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
- <h1 id="apache-fop-pdf-encryption">Apache™ FOP: PDF encryption.</h1>
+ <h1 id="apache-fop-pdf-signing-and-encryption">Apache™ FOP: PDF signing and encryption.</h1>
<p><authors><person email="pietsch@apache.org" name="J.Pietschmann"></person><person email="jeremias@apache.org" name="Jeremias Märki"></person></authors></p>
<h2 id="Overview">Overview</h2>
<p>Apache™ FOP supports encryption of PDF output, thanks to Patrick C. Lankswert and others. This feature is commonly used to prevent unauthorized viewing, printing, editing, copying text from the document and doing annotations. It is also possible to ask the user for a password in order to view the contents. Note that there already exist third party applications which can decrypt an encrypted PDF without effort and allow the aforementioned operations, therefore the degree of prote [...]
<p>For further information about features and restrictions regarding PDF encryption, look at the documentation coming with Adobe Acrobat or the technical documentation on the Adobe web site.</p>
-<h2 id="fopxconf">Usage (fop.xconf)</h2>
+<h2 id="signing-usage">Signing usage</h2>
+<p>To sign a PDF you need to generate a pkcs12 file using the openssl command line tool:</p>
+<div class="highlight"><pre><span></span><code><span class="err">openssl req -new -newkey rsa:4096 -nodes -keyout my.key -out my.csr</span>
+<span class="err">openssl x509 -req -sha256 -days 365 -in my.csr -signkey my.key -out my.pem</span>
+<span class="err">cat my.key my.pem > my2.pem</span>
+<span class="err">openssl pkcs12 -export -in my2.pem -out mykeystore.pkcs12 -name myAlias</span>
+</code></pre></div>
+
+<p>Add params to the fop.xconf:</p>
+<div class="highlight"><pre><span></span><code><span class="nt"><renderer</span> <span class="na">mime=</span><span class="s">"application/pdf"</span><span class="nt">></span>
+ <span class="nt"><sign-params></span>
+ <span class="nt"><keystore></span>path/mykeystore.pkcs12<span class="nt"></keystore></span>
+ <span class="nt"><name></span>your name<span class="nt"></name></span>
+ <span class="c"><!-- Below are optional --></span>
+ <span class="nt"><location></span>London UK<span class="nt"></location></span>
+ <span class="nt"><reason></span>text<span class="nt"></reason></span>
+ <span class="nt"><password></span>pkcs12 password<span class="nt"></password></span>
+ <span class="nt"></sign-params></span>
+<span class="nt"></renderer></span>
+</code></pre></div>
+
+<p>Add these to your classpath or maven pom file:</p>
+<div class="highlight"><pre><span></span><code><span class="nt"><dependency></span>
+ <span class="nt"><groupId></span>org.bouncycastle<span class="nt"></groupId></span>
+ <span class="nt"><artifactId></span>bcpkix-jdk15to18<span class="nt"></artifactId></span>
+ <span class="nt"><version></span>1.77<span class="nt"></version></span>
+<span class="nt"></dependency></span>
+<span class="nt"><dependency></span>
+ <span class="nt"><groupId></span>org.bouncycastle<span class="nt"></groupId></span>
+ <span class="nt"><artifactId></span>bcprov-jdk15to18<span class="nt"></artifactId></span>
+ <span class="nt"><version></span>1.77<span class="nt"></version></span>
+<span class="nt"></dependency></span>
+</code></pre></div>
+
+<h2 id="fopxconf">Encryption usage (fop.xconf)</h2>
<div class="highlight"><pre><span></span><code><span class="nt"><renderer</span> <span class="na">mime=</span><span class="s">"application/pdf"</span><span class="nt">></span>
<span class="nt"><encryption-params></span>
<span class="nt"><user-password></span>testuserpass<span class="nt"></user-password></span>
@@ -1622,7 +1656,7 @@ h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover
<span class="nt"></renderer></span>
</code></pre></div>
-<h2 id="commandline">Usage (command line)</h2>
+<h2 id="commandline">Encryption usage (command line)</h2>
<p>Encryption is enabled by supplying any of the encryption related options.</p>
<p>An owner password is set with the <code>-o</code> option. This password is actually used as encryption key. Many tools for PDF processing ask for this password to disregard any restriction imposed on the PDF document.</p>
<p>If no owner password has been supplied but FOP was asked to apply some restrictions, a random password is used. In this case it is obviously impossiible to disregard restrictions in PDF processing tools.</p>
@@ -1670,7 +1704,7 @@ h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover
</tr>
</tbody>
</table>
-<h2 id="embedded">Usage (embedded)</h2>
+<h2 id="embedded">Encryption usage (embedded)</h2>
<p>When FOP is embedded in another Java application you need to set an options map on the renderer. These are the supported options:</p>
<table>
<thead>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org