pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Evan Williams <evan.willi...@zapprx.com>
Subject Re: Going from 1.8.9 to 2.0
Date Thu, 25 Jun 2015 20:40:27 GMT
Thank you so much!

On Thu, Jun 25, 2015 at 3:59 PM, Maruan Sahyoun <sahyoun@fileaffairs.de>
wrote:

> Hi,
>
> > Am 25.06.2015 um 19:31 schrieb Maruan Sahyoun <sahyoun@fileaffairs.de>:
> >
> > Hi,
> >
> >> Am 25.06.2015 um 19:27 schrieb Evan Williams <evan.williams@zapprx.com
> >:
> >>
> >> I apologize for my stupidity, but I have no idea how to get the value I
> >> need from a PDAppearanceEntry. It is obviously a map of appearance
> streams
> >> but I am not certain how to extract the actual name of the widget from
> the
> >> appearance entry. Could you possibly give me a bit more detail
> >
> > I'll send you a quick sample later today for the Gender field - and no
> need to apologize - it's us who should make it easier to work with PDFBox.
>
> Here you go:
>
>
>         PDDocument doc = PDDocument.load( new
> File("RheumatoidArthritis.pdf") );
>         PDAcroForm form = doc.getDocumentCatalog().getAcroForm();
>         PDTerminalField gender = (PDTerminalField) form.getField("Gender");
>
>         for (PDAnnotationWidget widget : gender.getWidgets())
>         {
>             System.out.println(((COSDictionary)
> widget.getAppearance().getNormalAppearance().getCOSObject()).keySet());
>         }
>
> BR
> Maruan
>
>
> >
> > BR
> > Maruan
> >
> >>
> >> Thank you, and once again, I apologize for being dense.
> >>
> >> On Thu, Jun 25, 2015 at 12:40 PM, Maruan Sahyoun <
> sahyoun@fileaffairs.de>
> >> wrote:
> >>
> >>> Hi,
> >>>
> >>>> Am 25.06.2015 um 16:23 schrieb Evan Williams <
> evan.williams@zapprx.com>:
> >>>>
> >>>> When I said getOptions() returned null I meant it returns empty list.
> Not
> >>>> enough coffee. Everything else applies.
> >>>
> >>> I've created https://issues.apache.org/jira/browse/PDFBOX-2841 <
> >>> https://issues.apache.org/jira/browse/PDFBOX-2841> to handle that.
> >>>
> >>> - getOptions() returns the export values of the radio button group so
> >>> that's not what you are looking for (and we might rename that method to
> >>> better reflect it's intention)
> >>> - you could use getWidgets() to get the individual radio buttons and
> from
> >>> there for each individual widget
> >>> widget.getAppearance().getNormalAppearance() gives you the dictionary
> to
> >>> get the values from.
> >>>
> >>> BR
> >>> Maruan
> >>>
> >>>>
> >>>> On Thu, Jun 25, 2015 at 10:07 AM, Evan Williams <
> >>> evan.williams@zapprx.com>
> >>>> wrote:
> >>>>
> >>>>> Absolutely you can!
> >>>>>
> >>>>>
> >>>>>
> >>>
> https://drive.google.com/file/d/0B9TQWtr2Ipa9YlRORHVlTDVGS0k/view?usp=sharing
> >>>>>
> >>>>> But I strongly, strongly suspect that it is nothing to do with the
> pdf
> >>>>> document itself because there are many many forms from many many
> sources
> >>>>> and they all exhibit the same behavior.
> >>>>>
> >>>>> In the linked document I was, for example, able to enumerate 'Male'
> and
> >>>>> 'Female' as values for the Radio Button group 'Gender' with my 1.8.9
> >>> code.
> >>>>> In my 2.0 code I can't.
> >>>>>
> >>>>> The way I used to enumerate radio button groups was to call the
> >>> getKids()
> >>>>> method an the radio collection and enumerate the returned fields.
> That
> >>> is
> >>>>> not possible in 2.0 and I don't have anything that works. the
> PDButton
> >>>>> method goetOptions() always returns null.
> >>>>>
> >>>>> Thank you!
> >>>>>
> >>>>> On Thu, Jun 25, 2015 at 2:02 AM, Maruan Sahyoun <
> sahyoun@fileaffairs.de
> >>>>
> >>>>> wrote:
> >>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>>> Am 24.06.2015 um 22:20 schrieb Evan Williams <
> >>> evan.williams@zapprx.com
> >>>>>>> :
> >>>>>>>
> >>>>>>> I have an application written to use pdfbox 1.8.9 which
is all
> about
> >>>>>>> filling forms. I have a form library and I fill in values
in forms
> >>> using
> >>>>>>> data I am handed.
> >>>>>>>
> >>>>>>> One of the things I also need to do is do introspection
on the pdf
> >>>>>> document
> >>>>>>> to find out what fields are in it and make a template for
filling
> the
> >>>>>> form
> >>>>>>> with data in my application.
> >>>>>>>
> >>>>>>> I am trying to get my application to work with pdfbox 2.0.
Getting
> the
> >>>>>>> forms I have to fill was pretty straightforward.
> >>>>>>>
> >>>>>>> But I am having some difficulty with the introspection.
> >>>>>>>
> >>>>>>> For the templates I like to have an enumeration of the possible
> values
> >>>>>> of
> >>>>>>> the field if the field has such values. For example the
names of
> the
> >>>>>>> possible values for a collection of radio buttons.
> >>>>>>>
> >>>>>>> I understood how to get those values for the 1.8.9
> PDRadioCollection
> >>>>>> but I
> >>>>>>> have tried various things to get the same information for
the 2.0
> >>>>>>> PDRadioButton and I am not getting the information I need.
the
> >>>>>> getOptions()
> >>>>>>> method on PDButton looked like exactly what I needed. But
it always
> >>>>>> returns
> >>>>>>> null for me.
> >>>>>>>
> >>>>>>
> >>>>>> could you upload a sample form to a public location to take
a look?
> >>>>>>
> >>>>>> BR
> >>>>>> Maruan
> >>>>>>
> >>>>>>> As an aside I also used to get the on and off values of
checkboxes
> >>> with
> >>>>>>> getOnValue() and getOffValue(). These are in the Javadoc
but
> appear to
> >>>>>> not
> >>>>>>> be in the actual API. I don't care very much about those,
but they
> >>> were
> >>>>>>> nice to have, and the Javadoc should be accurate as much
as
> possible.
> >>>>>>>
> >>>>>>> If anyone can help me with the RadioButton thing that would
be a
> big
> >>>>>> help.
> >>>>>>>
> >>>>>>> Thank you.
> >>>>>>> --
> >>>>>>> *Evan Williams*
> >>>>>>> Sr. Software Engineer
> >>>>>>> evan.williams@zapprx.com
> >>>>>>>
> >>>>>>> *www.ZappRx.com <http://www.zapprx.com/>*
> >>>>>>
> >>>>>>
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> >>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>> *Evan Williams*
> >>>>> Sr. Software Engineer
> >>>>> evan.williams@zapprx.com
> >>>>>
> >>>>> *www.ZappRx.com <http://www.zapprx.com/>*
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>> --
> >>>> *Evan Williams*
> >>>> Sr. Software Engineer
> >>>> evan.williams@zapprx.com
> >>>>
> >>>> *www.ZappRx.com <http://www.zapprx.com/>*
> >>>
> >>>
> >>
> >>
> >> --
> >> *Evan Williams*
> >> Sr. Software Engineer
> >> evan.williams@zapprx.com
> >>
> >> *www.ZappRx.com <http://www.zapprx.com/>*
> >
> >
> > ---------------------------------------------------------------------
> > 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
>
>


-- 
*Evan Williams*
Sr. Software Engineer
evan.williams@zapprx.com

*www.ZappRx.com <http://www.zapprx.com/>*

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