Hi,

> Am 24.08.2015 um 15:23 schrieb Andrew Crowe <[email protected]>:
> 
> 
> Hi,
> 
>     I have a service that takes in a PDF document and returns it as an
> XML document with the parameter name/values.  This works great except
> for PDChoiceFields.  Sometimes they come back ok, but other times they
> don't.  My code for returning the values is,
> 


which version of PDFBox are you using? Would it be possible to attach the print 
out of PDField.getDictionary() for the field where you would expect a value to 
be returned?

BR
Maruan

> ------------
> ...
> ...
> ...
>             } else if (field instanceof PDChoiceField) {
> 
>                 PDChoiceField cf = (PDChoiceField) field;
> 
>                 COSArray caAll = cf.getOptions();
>                 COSArray caSelected = cf.getSelectedOptions();
> 
>                 if (caSelected != null)
>                 {
>                     for (int i=0; i < caSelected.size(); i++)
>                     {
>                         COSBase cb  = caSelected.get(i);
>                         COSInteger cbInt = (COSInteger) cb;
> 
>                         COSBase cb2 = caAll.get(cbInt.intValue());
> 
>                         // Check its an array.  If its not then the
> selected item has no value
>                         if (cb2 instanceof COSArray)
>                         {
>                             COSArray vals = (COSArray) cb2;
> 
>                             fieldValue = vals.getString(0);
>                         }
>                     }
> 
>                 } else {
> 
>                     fieldValue = field.getValue();
>                 }
> 
> --------------
> 
> This is returning null, even if there are values in the field. I cant attach 
> the example file as its too large.
> 
> Has anyone come across this, or know how to solve the issue?
> 
> Many thanks
> 
> Andy Crowe
> -- 
> ------------------------------------------------------------------------------
> Andrew Crowe,
> T H E Senior Software Developer
> O P E N Apex Plaza,Forbury Road,Reading,Berkshire RG1 ALX
> G R O U P Mailto:[email protected]     Tel: +44 118 902 3033
> WWW: http://www.opengroup.org    Fax: +44 118 950 0110
> 
> UNIX is a registered trademark of The Open Group in the US and other
> countries
> ------------------------------------------------------------------------------
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to