pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: [Non-DoD Source] Re: Update: org.apache.pdfbox.exceptions.WrappedIOException
Date Fri, 08 Apr 2016 15:52:29 GMT
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.
>
> 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 [mailto:THausherr@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-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message