I just tried it with 1.8.10 and it works fine:
>java -jar pdfbox-app-1.8.10.jar PDFReader -nonSeq "XXXXX\A3161_Blank.pdf"
Apr 08, 2016 7:19:27 PM
org.apache.pdfbox.pdfparser.NonSequentialPDFParser prepareDecryption
WARNUNG: PDF file 'XXXXXX\A3161_Blank.pdf' does not allow extracting
content.
Apr 08, 2016 7:19:28 PM org.apache.pdfbox.util.PDFStreamEngine
processOperator
INFORMATION: unsupported/disabled operation: i
Apr 08, 2016 7:19:28 PM org.apache.pdfbox.util.PDFStreamEngine
processOperator
INFORMATION: unsupported/disabled operation: ri
Apr 08, 2016 7:19:28 PM org.apache.pdfbox.util.PDFStreamEngine
processOperator
INFORMATION: unsupported/disabled operation: BDC
Apr 08, 2016 7:19:29 PM org.apache.pdfbox.util.PDFStreamEngine
processOperator
INFORMATION: unsupported/disabled operation: EMC
and the file is displayed.
Maybe you still have the old files in your classpath.
And the current version is 1.8.11. Not 1.8.10.
Tilman
Am 08.04.2016 um 19:09 schrieb Strein, Mark C CIV USARMY TRADOC ANALYSIS
CTR (US):
Tilman interesting,
This is what I get:
Apr 08, 2016 11:42:31 AM org.apache.pdfbox.pdfparser.NonSequentialPDFParser
prepareDecryption
WARNING: PDF file '.\Forms\A3161_Blank.pdf' does not allow extracting content.
Error occured when trying to load the PDF file: ./Forms/A3161_Blank.pdf
org.apache.pdfbox.exceptions.WrappedIOException
at
org.apache.pdfbox.pdmodel.encryption.SecurityHandler.encryptData(SecurityHandler.java:372)
at
org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptStream(SecurityHandler.java:476)
at
org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decrypt(SecurityHandler.java:434)
at
org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptObject(SecurityHandler.java:404)
at
org.apache.pdfbox.pdmodel.encryption.SecurityHandler.proceedDecryption(SecurityHandler.java:222)
at
org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.decryptDocument(StandardSecurityHandler.java:158)
at
org.apache.pdfbox.pdmodel.PDDocument.openProtection(PDDocument.java:1609)
at
lib.TRACJavaLibrary.io.formFile.FormFileManager$PDFFileManager.<init>(FormFileManager.java:927)
at
lib.TRACJavaLibrary.io.formFile.FormFileManager.<init>(FormFileManager.java:122)
at
lib.TRACJavaLibrary.io.formFile.FormFileManager.<init>(FormFileManager.java:86)
at src.utility.DA3161.<init>(DA3161.java:51)
at src.utility.PDF3161.<init>(PDF3161.java:23)
at src.userInterface.HRPanel.getDA3161(HRPanel.java:1931)
at src.userInterface.HRPanel.createDA3161(HRPanel.java:2227)
at src.application.Main$19.actionPerformed(Main.java:890)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown
Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
Source)
at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: javax.crypto.IllegalBlockSizeException: Input length must be
multiple of 16 when decrypting with padded cipher
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:913)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:824)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:436)
at javax.crypto.Cipher.doFinal(Cipher.java:2048)
at
org.apache.pdfbox.pdmodel.encryption.SecurityHandler.encryptData(SecurityHandler.java:352)
Here is my code when using pdfbox-1.8.10-src:
File originalPDF = new File(pdfFileName);
RandomAccess raFile = new RandomAccessFile(new
File("TempFile"),"rw");
pdDocument = PDDocument.loadNonSeq(originalPDF, raFile);
boolean isOriginalDocEncrypted = pdDocument.isEncrypted();
if (isOriginalDocEncrypted)
{
pdDocument.openProtection(new
StandardDecryptionMaterial(""));
}
pdDocumentCatalog = pdDocument.getDocumentCatalog();
pdAcroForm = pdDocumentCatalog.getAcroForm();
You used Java 1.7.0
With
Pdfbox-1.8.6(source),
bcmail-jdk15-1.44.jar,
bcprov-jdk15-1.44.jar,
commons-logging-1.1.2.jar,
fontbox-1.8.6.jar,
jempbox-1.8.6.jar
the above code base opens this file:
https://drive.google.com/open?id=0B6pmrwnJExGzVWQ3S3cxaHczWXc (file name
should have been A3161_Blank.pdf)
The code base below will not open it:
Java 8,
pdfbox-1.8.10-src
bcmail-jdk16-1.46.jar
bcprov-jdk16-1.46.jar
commons-logging-1.1.2.jar
fontbox-1.8.10.jar
jempbox-1.8.10.jar
icu4j.jar
-----Original Message-----
From: Tilman Hausherr [mailto:thaush...@t-online.de]
Sent: Friday, April 08, 2016 10:52 AM
To: users@pdfbox.apache.org
Subject: Re: [Non-DoD Source] Re: Update:
org.apache.pdfbox.exceptions.WrappedIOException
All active links contained in this email were disabled. Please verify the
identity of the sender, and confirm the authenticity of all links contained
within the message prior to copying and pasting the address to a Web browser.
----
I was able to open this file with 2.0, 1.8.11, both classic and nonSeq parser.
It failed to open in the 1.8.6 version.
Tilman
Am 08.04.2016 um 15:09 schrieb Strein, Mark C CIV USARMY TRADOC ANALYSIS CTR
(US):
"That means you bypassed the problem instead of confronting and solving it."
True..
I did as you suggested:
"PDDocument doc = PDDocument.loadNonSeq(new File(...));"
It did not work on the file below.
Caution-https://drive.google.com/open?id=0B6pmrwnJExGzVWQ3S3cxaHczWXc
The pdf I pointed you to yesterday was not a fillable or sign able version that
we use here.
Try the one in the link.
Thank you for your help.
Mark....
-----Original Message-----
From: Tilman Hausherr [Caution-mailto:thaush...@t-online.de]
Sent: Thursday, April 07, 2016 12:39 PM
To: users@pdfbox.apache.org
Subject: [Non-DoD Source] Re: Update:
org.apache.pdfbox.exceptions.WrappedIOException
Am 07.04.2016 um 17:06 schrieb Strein, Mark C CIV USARMY TRADOC ANALYSIS CTR
(US):
Hello all,
I hacked my way around it. Used my old software to save the pdf with security
removed.
Then did the explorer save to adobe trick.
That means you bypassed the problem instead of confronting and solving it.
Re your code change suggestion - I can't comment it, I suggest you post a diff
patch in JIRA. Don't forget to mention what version this is for.
Tilman
I would like to make a suggested code change in the PDChoiceField class if I
may(see TODO):
public void setValue(String optionValue) throws IOException
{
//TODO - in the instance where an option list doesn't have a default
option
//We need to allow for the case where no selection was made.
//When reading a blank form, the value returned to us is null. The
current code
//does not handle the possibility of a choice field not being set.
if(optionValue==null||optionValue.equalsIgnoreCase(""))
{
super.setValue("");
return;
}
int indexSelected = -1;
COSArray options = (COSArray)
getDictionary().getDictionaryObject(COSName.OPT);
int fieldFlags = getFieldFlags();
boolean isEditable = (FLAG_COMBO & fieldFlags) != 0 &&
(FLAG_EDIT & fieldFlags) != 0;
if (options.size() == 0 && !isEditable)
{
throw new IOException("Error: You cannot set a value for a choice
field if there are no options.");
}
else
{
// YXJ: Changed the order of the loops. Acrobat produces PDF's
// where sometimes there is 1 string and the rest arrays.
// This code works either way.
for (int i = 0; i < options.size() && indexSelected == -1; i++)
{
COSBase option = options.getObject(i);
if (option instanceof COSArray)
{
COSArray keyValuePair = (COSArray) option;
COSString key = (COSString) keyValuePair.getObject(0);
COSString value = (COSString) keyValuePair.getObject(1);
if (optionValue.equals(key.getString()) ||
optionValue.equals(value.getString()))
{
// have the parent draw the appearance stream with
the value
if ((FLAG_COMBO & fieldFlags) != 0)
{
super.setValue(value.getString());
}
else
{
COSArray indexEntries = new COSArray();
indexEntries.add(COSInteger.get((long) i));
getDictionary().setItem(COSName.I, indexEntries);
setListboxValue(value.getString());
}
// but then use the key as the V entry
getDictionary().setItem(COSName.V, key);
indexSelected = i;
}
}
else
{
COSString value = (COSString) option;
if (optionValue.equals(value.getString()))
{
super.setValue(optionValue);
indexSelected = i;
}
}
}
}
if (indexSelected == -1 && isEditable)
{
super.setValue(optionValue);
}
else if (indexSelected == -1)
{
throw new IOException("Error: '" + optionValue + "' was not an
available option.");
}
else
{
COSArray indexArray = (COSArray)
getDictionary().getDictionaryObject(COSName.I);
if (indexArray != null)
{
indexArray.clear();
indexArray.add(COSInteger.get(indexSelected));
}
}
}
V/R,
Mark Strein
TRAC-FLVN
Wargaming and Simulations Directorate Analytic Tools Division -
Paving Crew Keeper of the Codes
913-684-9309
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org