pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wojack, Robert (USTP)" <Robert.Woj...@usdoj.gov>
Subject How to trim whitespace from options in a combobox on an existing PDF form?
Date Tue, 29 Dec 2015 20:45:59 GMT
We have a client that provides us with interactive PDF forms for our app to populate fields
with user data.

The problem is the client sometimes provides us forms with typos and is not responsive about
fixing them. In this case, we are given a form with a combo box of options, and some of the
options accidentally have trailing or leading whitespace. So when we attempt to select an
option using the setValue(String optionValue) method, it fails to match (i.e., "Maine" fails
to match the "Maine " option on the form).

As a workaround, we can add the extraneous whitespace to induce a match for these occasional
goofs, but of course that is extremely hacky. Is there a way to trim all of the whitespace
from all of the option values in an existing PDF before attempting to set the value?

We are using PDFBox 1.2.1, but we are open to upgrading to a newer version.

Thanks

Bob Wojack


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message