I think I found the problem. Your file has been written with EBCDIC code
:-( It is this code (and possibly elsewhere too):
private void writeXrefRange(long x, long y) throws IOException
{
getStandardOutput().write(String.valueOf(x).getBytes());
getStandardOutput().write(SPACE);
getStandardOutput().write(String.valueOf(y).getBytes());
getStandardOutput().writeEOL();
}
And it should have been
private void writeXrefRange(long x, long y) throws IOException
{
getStandardOutput().write(String.valueOf(x).getBytes(Charsets.ISO_8859_1));
getStandardOutput().write(SPACE);
getStandardOutput().write(String.valueOf(y).getBytes(Charsets.ISO_8859_1));
getStandardOutput().writeEOL();
}
I'll open an issue and fix this later today. I guess you're the first
person in the world to use PDFBox on that OS.
Tilman
Am 20.06.2015 um 00:46 schrieb Santiago Cardoso Geller:
Hi Tilman. I found that the error is in the pdf generated previously with
the TextToPDF command.
This is my environment:
OS: Unix Service running on Z/OS.
JRE: JRE 1.6.0 IBM J9 2.4 z/OS s390-31
PDFBOX: pdfbox-app-1.8.9.jar
I uploaded the original test.txt file and the pdf generated from z/OS (and
also another one generated on Win7) here:
https://www.dropbox.com/sh/k8lpjgxed0lxhfe/AADFnwW8y_7zJXe9gL3mz9UDa?dl=0
If you compare test_zos.pdf and test_win7.pdf you will find 2 bytes
different at line 58. If I change those bytes, then the encryption works
fine.
Thanks and regards,
Santiago
On Fri, Jun 19, 2015 at 6:25 PM, Tilman Hausherr <[email protected]>
wrote:
Could you please upload the file somewhere?
Tilman
Am 19.06.2015 um 22:27 schrieb Santiago Cardoso Geller:
Hi! I was trying to Encrypt a pdf from the command line by executing the
following:
java -jar pdfbox-app-1.8.9.jar Encrypt -U 12345 -O 12345 test.pdf
test-encrypted.pdf
But I get the following error:
Encrypt failed with the following exception:
java.io.IOException: Error: Expected a long type at offset 7321, instead
got '?'
at
org.apache.pdfbox.pdfparser.BaseParser.readLong(BaseParser.java:1695)
at
org.apache.pdfbox.pdfparser.BaseParser.readObjectNumber(BaseParser.java:1623)
at
org.apache.pdfbox.pdfparser.PDFParser.parseXrefTable(PDFParser.java:818)
at
org.apache.pdfbox.pdfparser.PDFParser.parseObject(PDFParser.java:540)
at
org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:203)
at
org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1220)
at
org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1187)
at
org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1112)
at org.apache.pdfbox.Encrypt.encrypt(Encrypt.java:158)
at org.apache.pdfbox.Encrypt.main(Encrypt.java:53)
at org.apache.pdfbox.PDFBox.main(PDFBox.java:54)
I only downloaded pdfbox-app-1.8.9.jar file. Is it required something
else?
Thanks,
Santiago
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]