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 2016/04/18 20:08:44 UTC
pdfbox-docs git commit: PDFBOX-3030: fix missing variable in PDF
rendering sample; fix styling
Repository: pdfbox-docs
Updated Branches:
refs/heads/master 09ca86e5e -> 268316003
PDFBOX-3030: fix missing variable in PDF rendering sample; fix styling
Project: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/commit/26831600
Tree: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/tree/26831600
Diff: http://git-wip-us.apache.org/repos/asf/pdfbox-docs/diff/26831600
Branch: refs/heads/master
Commit: 268316003cdb2d189dc1bfa13a33bca2f07eed5b
Parents: 09ca86e
Author: Maruan Sahyoun <sa...@fileaffairs.de>
Authored: Mon Apr 18 20:08:33 2016 +0200
Committer: Maruan Sahyoun <sa...@fileaffairs.de>
Committed: Mon Apr 18 20:08:33 2016 +0200
----------------------------------------------------------------------
content/2.0/cookbook/encryption.md | 32 +++++++++++++++++---------------
content/2.0/migration.md | 2 +-
content/css/site.css | 6 +++++-
3 files changed, 23 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/26831600/content/2.0/cookbook/encryption.md
----------------------------------------------------------------------
diff --git a/content/2.0/cookbook/encryption.md b/content/2.0/cookbook/encryption.md
index 672ac0c..6959592 100644
--- a/content/2.0/cookbook/encryption.md
+++ b/content/2.0/cookbook/encryption.md
@@ -31,23 +31,25 @@ 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");
+``` java
+PDDocument doc = PDDocument.load("filename.pdf");
- // Define the length of the encryption key.
- // Possible values are 40, 128 or 256.
- int keyLength = 256;
+// Define the length of the encryption key.
+// Possible values are 40, 128 or 256.
+int keyLength = 256;
- AccessPermission ap = new AccessPermission();
+AccessPermission ap = new AccessPermission();
- // disable printing, everything else is allowed
- ap.setCanPrint(false);
+// 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);
+// 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
+doc.save("filename-encrypted.pdf");
+doc.close();
+```
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/26831600/content/2.0/migration.md
----------------------------------------------------------------------
diff --git a/content/2.0/migration.md b/content/2.0/migration.md
index 2ca757b..19ec430 100644
--- a/content/2.0/migration.md
+++ b/content/2.0/migration.md
@@ -135,7 +135,7 @@ PDFRenderer pdfRenderer = new PDFRenderer(document);
int pageCounter = 0;
for (PDPage page : document.getPages())
{
- pdfRenderer.renderImageWithDPI(pageCounter, 300, ImageType.RGB);
+ BufferedImage bim = pdfRenderer.renderImageWithDPI(pageCounter, 300, ImageType.RGB);
// suffix in filename will be used as the file format
ImageIOUtil.writeImage(bim, pdfFilename + "-" + (pageCounter++) + ".png", 300);
http://git-wip-us.apache.org/repos/asf/pdfbox-docs/blob/26831600/content/css/site.css
----------------------------------------------------------------------
diff --git a/content/css/site.css b/content/css/site.css
index d583634..b061d36 100644
--- a/content/css/site.css
+++ b/content/css/site.css
@@ -77,8 +77,12 @@ h4 .open-iconic {
fill: #0088cc;
}
-code, pre {
+.highlight > pre {
color: darkslategrey;
+ border: 0pt;
+ border-radius: 0pt;
+ border-left: 5px solid #0088cc;
+ padding-left: 2rem;
}
/*