A choice field allows to have a display value as well as an export value. You 
can retrieve the defined values using

   choice.getOptionsDisplayValues() 
   choice.getOptionsExportValues()

So set the value you can use the export value (or values if multiselect is 
allowed). Some of the options can be seen in the unit
test TestListBox.java


BR
Maruan
 
> 
> 
> > Am 18.09.2018 um 18:54 schrieb Dagnon, William <william.dag...@wpsic.com>:
> > 
> > Maruan and Tilman,
> > 
> > Thanks for your responses:
> > 
> > * I can't tell how PDButtonTest is supposed to help: there are no 
> > PDComboBox nor PDChoice controls in that class, and the only way any 
> > controls are changed is with ctrl.setValue("string") (or 
> > checkbox.check()) which, as my screenshot shows, did change the "V" (value) 
> > but does not display anything for combo boxes.
> 
> Ah - sorry - somehow I got that you are using Checkboxes. I'll take another 
> look
> 
> > 
> > * Per Tilman, here is 'N' highlighted:  imgur.com/a/M3XORNs
> > This is different in a few ways from a selected, visible version:
> > A) this has "/DeviceGray cs" at the top, a viewable one doesn't
> > B) a viewable one, where I manually selected it, has "(Part ) Tj" and later 
> > a "(B) Tj" row, whereas this one only has one "(Part B) Tj" row...
> > 
> > * I tried getting 2.0.11 to work locally for most of yesterday, but 
> > WebSphere refused to load fontbox 2.0.11 for some reason - even after 
> > extensive re-Mavening and rebuilding.
> > 
> > * if it helps, I'm viewing in Adobe Acrobat Reader DC 2018.11.20058
> > 
> > * In comparing the file saved by PDFBox which does not display text for the 
> > combo boxes, versus one where I manually selected what I wanted in them 
> > (through Reader DC) and saved it, the most obvious difference is that the 
> > PDFBox file is missing the "I: (1)" and subrow "0:0". (or "0:1", etc., 
> > depending on which index I selected).
> > So.. maybe Reader knows the value from "V" but doesn't know what to display 
> > without the index being set?
> > 
> > 
> > If I have time, I'll try debugging with attaching PDFBox's source, but I 
> > doubt that'll be today.
> > 
> > Thanks again!
> > 
> > 
> > -----Original Message-----
> > From: Maruan Sahyoun <sahy...@fileaffairs.de>
> > Sent: Tuesday, September 18, 2018 9:36 AM
> > To: users@pdfbox.apache.org
> > Subject: Re: PDComboBox.setValue("selection text") displays nothing?
> > 
> > Hi,
> > 
> > please take a look at the unit test class PDButtonTest to see how to set 
> > the value dependent on the fields definition. You could also try to use 
> > checkbox.getOnValues() to get the list of valid values which are causing 
> > the individual checkboxes to be set.
> > 
> > Please also note that - as Tillmann already pointed out - it's a good idea 
> > to use 2.0.11.
> > 
> > Eg. you might be affected by ... which has been resolved in 2.0.5., 
> > PDFBOX-3753 which has been resolved in 2.0.6  and others.
> > 
> > BR
> > Maruan
> > 
> > 
> > > Maruan, please give this a try: imgur.com/a/o3SqsCn
> > > 
> > > 
> > > ALSO wrt:
> > > "Current version is 2.0.11, please retry with that one.
> > > 
> > > Tilman"
> > > 
> > > Thanks, cannot but will promote the idea localy: the version is out of my 
> > > control.  Why, were fixed introduced for ComboBoxes?
> > > 
> > > 
> > > -----Original Message-----
> > > From: Maruan Sahyoun <sahy...@fileaffairs.de>
> > > Sent: Monday, September 17, 2018 11:06 AM
> > > To: users@pdfbox.apache.org
> > > Subject: Re: PDComboBox.setValue("selection text") displays nothing?
> > > 
> > > Could you do a screenshot of the fields definition in PDFDebugger with 
> > > the subtrees expanded and upload that?
> > > 
> > > BR
> > > Maruan
> > > 
> > > > Thanks for the response:
> > > > 
> > > > PDFBox 2.0.4
> > > > 
> > > > Please look right above your questions to see the 3 ways I've used to 
> > > > set the values, though since I'm only ever setting a single value, they 
> > > > always come down to:
> > > > 
> > > > ctrl.setValue(String); // the only operation on any control on the
> > > > PDF
> > > > 
> > > > While I can create a PDF, I doubt I can put it anywhere public - and 
> > > > asking the lawyers about it would take a while.
> > > > 
> > > > 
> > > > -----Original Message-----
> > > > From: Maruan Sahyoun <sahy...@fileaffairs.de>
> > > > Sent: Monday, September 17, 2018 10:31 AM
> > > > To: users@pdfbox.apache.org
> > > > Subject: Re: PDComboBox.setValue("selection text") displays nothing?
> > > > 
> > > > WARNING: This is an external email that originated outside of the WPS 
> > > > email system.
> > > > DO NOT CLICK links or open attachments unless you recognize the sender 
> > > > and know the content is safe!
> > > > 
> > > > Hi,
> > > > > Am 17.09.2018 um 17:05 schrieb Dagnon, William 
> > > > > <william.dag...@wpsic.com>:
> > > > > 
> > > > > Hello again all,
> > > > > 
> > > > > I'm trying to fill out someone else's PDF programmatically, and while 
> > > > > the text values work fine as before, the controls with Opts never 
> > > > > display their values after I've set them.  In the saved PDF, there is 
> > > > > no text at the ComboBox's location, but using PDFDebugger the 
> > > > > annotation and Opts are still there.  Just not visible...?  "V" is 
> > > > > the correct value as set.
> > > > > 
> > > > > The control looks fine when I look at the original, and I can select 
> > > > > what I want from the box manually through an Adobe GUI.
> > > > > 
> > > > > Comparing the original vs PDFBox saved files, each of the 4 CombBox 
> > > > > controls have exactly these differences:
> > > > > 
> > > > > 1.  V, because I set it
> > > > > 2.  "P": first # in [] goes from 61 to 312, plus lower details
> > > > > differ 3.  There is a new "I: (1)" entry for the annotation
> > > > > 
> > > > > Text controls:
> > > > > 
> > > > > 1.  Have a "V" (didn't in the original - no defaults)  2.  Have
> > > > > the same change to "P"
> > > > > 3.  Have the same "AP" as before, or a new "AP" if one didn't exist.
> > > > > 
> > > > > All of the ComboBoxes have the same font("DA: /Helv 12 Tf  g"), but 
> > > > > the couple text controls with the same font display fine.
> > > > > 
> > > > > I HAVE TRIED:
> > > > > A) Originally I'd just control.setValue("foobar") for the Opt 
> > > > > controls just like the text controls, but that gave no results.
> > > > > 
> > > > > B) The only code example Google returns is a stackoverflow where they 
> > > > > have a font problem, but I tried control.setValue(opts.get(index)) - 
> > > > > with no further luck.
> > > > > 
> > > > > C) I've also looked at the opts themselves and they do exist - though 
> > > > > as COSString objects. But they have exactly the same text, and I'm 
> > > > > able to search through them for equal strings in order to determine 
> > > > > the index.
> > > > 
> > > > which version of PDFBox are you using? How do you set the value? Would 
> > > > you have a sample PDF to be able to give you some specific code (please 
> > > > upload to a shared location)?
> > > > 
> > > > BR
> > > > Maruan
> > > > 
> > > > 
> > > > > 
> > > > > 
> > > > > How ARE PDComboBox controls supposed to work?  Or am I using the 
> > > > > wrong control altogether?
> > > > > 
> > > > > Thanks...
> > > > > 
> > > > > 
> > > > > P.S. I am now seeing a DEBUG log: "ScratchFileBuffer:516 - 
> > > > > ScratchFileBuffer not closed!" which I don't remember from before...
> > 
> > CONFIDENTIALITY NOTICE: This e-mail, including any attachments, may contain 
> > confidential, privileged and/or proprietary information which is solely for 
> > the use of the intended recipient(s). Any review, use, disclosure, or 
> > retention by others is strictly prohibited. If you are not an intended 
> > recipient, please contact the sender and delete this e-mail, any 
> > attachments, and all copies.
> > 
> > ---------------------------------------------------------------------
> > 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
> 
-- 
Maruan Sahyoun

FileAffairs GmbH
Josef-Schappe-Straße 21
40882 Ratingen

Tel: +49 (2102) 89497 88
Fax: +49 (2102) 89497 91
sahy...@fileaffairs.de
www.fileaffairs.de

Geschäftsführer: Maruan Sahyoun
Handelsregister: AG Düsseldorf, HRB 53837
UST.-ID: DE248275827


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

Reply via email to