Apache pdfbox claims that PDF documents are encrypted (but they are not!) - fix?
In my program I am downloading misc. PDF documents and at the very end I want to merge those into one combined document using Apache pdfbox (v1.8.8).
For some strange reason the PDFMergerUtility fails claiming that the files are encryped - which they are obviously not! I can open them in Adobe Reader and other PDF viewers without any issue and without having to provide any password.
The Java exception and stack trace reads:
Feb 28, 2015 6:25:54 PM org.apache.pdfbox.pdfparser.PDFParser parse
INFO: Document is encrypted
Failed to merge all files into downloadedpage merged.pdf: Error: source PDF is encrypted, can't append encrypted PDF documents.
java.io.IOException: Error: source PDF is encrypted, can't append encrypted PDF documents.
at org.apache.pdfbox.util.PDFMergerUtility.appendDocument(PDFMergerUtility.java:284)
at org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:241)
at org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:194)
at mmo.pull_ct.PullCT.mergePDFs(PullCT.java:481)
Anybody having the same issue and/or maybe knows a fix or work-around?
This is using Java (1.)8 under Windows 8.1 (x64).
java pdfbox
add a comment |
In my program I am downloading misc. PDF documents and at the very end I want to merge those into one combined document using Apache pdfbox (v1.8.8).
For some strange reason the PDFMergerUtility fails claiming that the files are encryped - which they are obviously not! I can open them in Adobe Reader and other PDF viewers without any issue and without having to provide any password.
The Java exception and stack trace reads:
Feb 28, 2015 6:25:54 PM org.apache.pdfbox.pdfparser.PDFParser parse
INFO: Document is encrypted
Failed to merge all files into downloadedpage merged.pdf: Error: source PDF is encrypted, can't append encrypted PDF documents.
java.io.IOException: Error: source PDF is encrypted, can't append encrypted PDF documents.
at org.apache.pdfbox.util.PDFMergerUtility.appendDocument(PDFMergerUtility.java:284)
at org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:241)
at org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:194)
at mmo.pull_ct.PullCT.mergePDFs(PullCT.java:481)
Anybody having the same issue and/or maybe knows a fix or work-around?
This is using Java (1.)8 under Windows 8.1 (x64).
java pdfbox
3
Some documents have an empty user password, but a non-empty owner password. You can open such a file, but there will be restrictions, e.g. no printing or no text extraction. To be sure, open the PDF file with NOTEPAD++, and search for "/Encrypt". If you find it, then the file is encrypted.
– Tilman Hausherr
Mar 1 '15 at 23:01
3
I can open them in Adobe Reader and other PDF viewers without any issue and without having to provide any password. - That does not prove anything. PDF standards define a standard password which is appended to the given password. By this means empty passwords given by the viewing user are allowed.
– mkl
Mar 1 '15 at 23:47
Right - the file was indeed encrypted but with an empty password. Hadn't known that this is the usual way to enforce PDF restrictions and that misc. viewers try that automatically when encountering an "encrypted" file! Thanks both!
– mmo
Mar 2 '15 at 0:22
@mmo You can answer your question. I would have +1'ed it :)
– Nenotlep
Mar 9 '17 at 11:47
add a comment |
In my program I am downloading misc. PDF documents and at the very end I want to merge those into one combined document using Apache pdfbox (v1.8.8).
For some strange reason the PDFMergerUtility fails claiming that the files are encryped - which they are obviously not! I can open them in Adobe Reader and other PDF viewers without any issue and without having to provide any password.
The Java exception and stack trace reads:
Feb 28, 2015 6:25:54 PM org.apache.pdfbox.pdfparser.PDFParser parse
INFO: Document is encrypted
Failed to merge all files into downloadedpage merged.pdf: Error: source PDF is encrypted, can't append encrypted PDF documents.
java.io.IOException: Error: source PDF is encrypted, can't append encrypted PDF documents.
at org.apache.pdfbox.util.PDFMergerUtility.appendDocument(PDFMergerUtility.java:284)
at org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:241)
at org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:194)
at mmo.pull_ct.PullCT.mergePDFs(PullCT.java:481)
Anybody having the same issue and/or maybe knows a fix or work-around?
This is using Java (1.)8 under Windows 8.1 (x64).
java pdfbox
In my program I am downloading misc. PDF documents and at the very end I want to merge those into one combined document using Apache pdfbox (v1.8.8).
For some strange reason the PDFMergerUtility fails claiming that the files are encryped - which they are obviously not! I can open them in Adobe Reader and other PDF viewers without any issue and without having to provide any password.
The Java exception and stack trace reads:
Feb 28, 2015 6:25:54 PM org.apache.pdfbox.pdfparser.PDFParser parse
INFO: Document is encrypted
Failed to merge all files into downloadedpage merged.pdf: Error: source PDF is encrypted, can't append encrypted PDF documents.
java.io.IOException: Error: source PDF is encrypted, can't append encrypted PDF documents.
at org.apache.pdfbox.util.PDFMergerUtility.appendDocument(PDFMergerUtility.java:284)
at org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:241)
at org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:194)
at mmo.pull_ct.PullCT.mergePDFs(PullCT.java:481)
Anybody having the same issue and/or maybe knows a fix or work-around?
This is using Java (1.)8 under Windows 8.1 (x64).
java pdfbox
java pdfbox
asked Mar 1 '15 at 22:30
mmo
1,42982542
1,42982542
3
Some documents have an empty user password, but a non-empty owner password. You can open such a file, but there will be restrictions, e.g. no printing or no text extraction. To be sure, open the PDF file with NOTEPAD++, and search for "/Encrypt". If you find it, then the file is encrypted.
– Tilman Hausherr
Mar 1 '15 at 23:01
3
I can open them in Adobe Reader and other PDF viewers without any issue and without having to provide any password. - That does not prove anything. PDF standards define a standard password which is appended to the given password. By this means empty passwords given by the viewing user are allowed.
– mkl
Mar 1 '15 at 23:47
Right - the file was indeed encrypted but with an empty password. Hadn't known that this is the usual way to enforce PDF restrictions and that misc. viewers try that automatically when encountering an "encrypted" file! Thanks both!
– mmo
Mar 2 '15 at 0:22
@mmo You can answer your question. I would have +1'ed it :)
– Nenotlep
Mar 9 '17 at 11:47
add a comment |
3
Some documents have an empty user password, but a non-empty owner password. You can open such a file, but there will be restrictions, e.g. no printing or no text extraction. To be sure, open the PDF file with NOTEPAD++, and search for "/Encrypt". If you find it, then the file is encrypted.
– Tilman Hausherr
Mar 1 '15 at 23:01
3
I can open them in Adobe Reader and other PDF viewers without any issue and without having to provide any password. - That does not prove anything. PDF standards define a standard password which is appended to the given password. By this means empty passwords given by the viewing user are allowed.
– mkl
Mar 1 '15 at 23:47
Right - the file was indeed encrypted but with an empty password. Hadn't known that this is the usual way to enforce PDF restrictions and that misc. viewers try that automatically when encountering an "encrypted" file! Thanks both!
– mmo
Mar 2 '15 at 0:22
@mmo You can answer your question. I would have +1'ed it :)
– Nenotlep
Mar 9 '17 at 11:47
3
3
Some documents have an empty user password, but a non-empty owner password. You can open such a file, but there will be restrictions, e.g. no printing or no text extraction. To be sure, open the PDF file with NOTEPAD++, and search for "/Encrypt". If you find it, then the file is encrypted.
– Tilman Hausherr
Mar 1 '15 at 23:01
Some documents have an empty user password, but a non-empty owner password. You can open such a file, but there will be restrictions, e.g. no printing or no text extraction. To be sure, open the PDF file with NOTEPAD++, and search for "/Encrypt". If you find it, then the file is encrypted.
– Tilman Hausherr
Mar 1 '15 at 23:01
3
3
I can open them in Adobe Reader and other PDF viewers without any issue and without having to provide any password. - That does not prove anything. PDF standards define a standard password which is appended to the given password. By this means empty passwords given by the viewing user are allowed.
– mkl
Mar 1 '15 at 23:47
I can open them in Adobe Reader and other PDF viewers without any issue and without having to provide any password. - That does not prove anything. PDF standards define a standard password which is appended to the given password. By this means empty passwords given by the viewing user are allowed.
– mkl
Mar 1 '15 at 23:47
Right - the file was indeed encrypted but with an empty password. Hadn't known that this is the usual way to enforce PDF restrictions and that misc. viewers try that automatically when encountering an "encrypted" file! Thanks both!
– mmo
Mar 2 '15 at 0:22
Right - the file was indeed encrypted but with an empty password. Hadn't known that this is the usual way to enforce PDF restrictions and that misc. viewers try that automatically when encountering an "encrypted" file! Thanks both!
– mmo
Mar 2 '15 at 0:22
@mmo You can answer your question. I would have +1'ed it :)
– Nenotlep
Mar 9 '17 at 11:47
@mmo You can answer your question. I would have +1'ed it :)
– Nenotlep
Mar 9 '17 at 11:47
add a comment |
2 Answers
2
active
oldest
votes
Answered by the comments from Tilman Hausherr and mkl above.
The Files were encrypted but using an empty password. Trying that got me going.
Thanks again!
add a comment |
As the pdf have empty password. This worked for me in a test project. Adding this answer as it took some time for me to figure it out, may help someone looking for the same issue.
PDDocument dl = PDDocument.load(is);
if (dl.isEncrypted()) {
// then try to load using
dl.decrypt("");
dl.setAllSecurityToBeRemoved(true);
// save a copy of the file
dl.save(tempPath);
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f28799979%2fapache-pdfbox-claims-that-pdf-documents-are-encrypted-but-they-are-not-fix%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Answered by the comments from Tilman Hausherr and mkl above.
The Files were encrypted but using an empty password. Trying that got me going.
Thanks again!
add a comment |
Answered by the comments from Tilman Hausherr and mkl above.
The Files were encrypted but using an empty password. Trying that got me going.
Thanks again!
add a comment |
Answered by the comments from Tilman Hausherr and mkl above.
The Files were encrypted but using an empty password. Trying that got me going.
Thanks again!
Answered by the comments from Tilman Hausherr and mkl above.
The Files were encrypted but using an empty password. Trying that got me going.
Thanks again!
answered Mar 9 '17 at 18:26
mmo
1,42982542
1,42982542
add a comment |
add a comment |
As the pdf have empty password. This worked for me in a test project. Adding this answer as it took some time for me to figure it out, may help someone looking for the same issue.
PDDocument dl = PDDocument.load(is);
if (dl.isEncrypted()) {
// then try to load using
dl.decrypt("");
dl.setAllSecurityToBeRemoved(true);
// save a copy of the file
dl.save(tempPath);
}
add a comment |
As the pdf have empty password. This worked for me in a test project. Adding this answer as it took some time for me to figure it out, may help someone looking for the same issue.
PDDocument dl = PDDocument.load(is);
if (dl.isEncrypted()) {
// then try to load using
dl.decrypt("");
dl.setAllSecurityToBeRemoved(true);
// save a copy of the file
dl.save(tempPath);
}
add a comment |
As the pdf have empty password. This worked for me in a test project. Adding this answer as it took some time for me to figure it out, may help someone looking for the same issue.
PDDocument dl = PDDocument.load(is);
if (dl.isEncrypted()) {
// then try to load using
dl.decrypt("");
dl.setAllSecurityToBeRemoved(true);
// save a copy of the file
dl.save(tempPath);
}
As the pdf have empty password. This worked for me in a test project. Adding this answer as it took some time for me to figure it out, may help someone looking for the same issue.
PDDocument dl = PDDocument.load(is);
if (dl.isEncrypted()) {
// then try to load using
dl.decrypt("");
dl.setAllSecurityToBeRemoved(true);
// save a copy of the file
dl.save(tempPath);
}
answered Dec 27 '18 at 20:03
A Paul
5,58911545
5,58911545
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f28799979%2fapache-pdfbox-claims-that-pdf-documents-are-encrypted-but-they-are-not-fix%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
Some documents have an empty user password, but a non-empty owner password. You can open such a file, but there will be restrictions, e.g. no printing or no text extraction. To be sure, open the PDF file with NOTEPAD++, and search for "/Encrypt". If you find it, then the file is encrypted.
– Tilman Hausherr
Mar 1 '15 at 23:01
3
I can open them in Adobe Reader and other PDF viewers without any issue and without having to provide any password. - That does not prove anything. PDF standards define a standard password which is appended to the given password. By this means empty passwords given by the viewing user are allowed.
– mkl
Mar 1 '15 at 23:47
Right - the file was indeed encrypted but with an empty password. Hadn't known that this is the usual way to enforce PDF restrictions and that misc. viewers try that automatically when encountering an "encrypted" file! Thanks both!
– mmo
Mar 2 '15 at 0:22
@mmo You can answer your question. I would have +1'ed it :)
– Nenotlep
Mar 9 '17 at 11:47