I suspect you are using 2.0, but the sample code is for 1.8.

Use

getValueAsString

instead of getValue.

Tilman

Am 11.02.2016 um 23:24 schrieb Al Grant:
Nearly there. Last line :     System.out.println(field.getPartialName() +
":" + field.getValue());

Is complaining during compile : Exception in thread "main"
java.lang.RuntimeException: Uncompilable source code - Erroneous tree type:
<any>
     at pdftest2.Pdftest2.main(Pdftest2.java:36)

Hovering over it in netbeans says cannot find symbol method GetValue

Cheers again

-AL


On Fri, Feb 12, 2016 at 11:13 AM, Al Grant <[email protected]> wrote:

Yes I am using NetBeans.

Thanks will try that.

Al
On 12/02/2016 11:12 am, "Tilman Hausherr" <[email protected]> wrote:

Am 11.02.2016 um 23:00 schrieb Al Grant:

HI Gilad and others

Sorry I am pretty new to java. I cant even get this line to run:

          PDDocument pdfDocument = PDDocument.load(new
File("C:\\Users\\Al\\Desktop\\test.pdf"));

I get a Exception in thread "main" java.lang.RuntimeException:
Uncompilable
source code - unreported exception java.io.IOException; must be caught or
declared to be thrown
      at pdftest2.Pdftest2.main(Pdftest2.java:28)

Error.

Can you please help?

Use an IDE like netbeans. This will put yellow hints and tell you what to
do. Maybe you are already using a good IDE. Hover your mouse over anything
in a different color.

Btw here you just need to add "throws IOException" at the end of the line
with "main".

Tilman



Thanks

-Al

On Fri, Feb 12, 2016 at 2:38 AM, Gilad Denneboom <
[email protected]>
wrote:

If the data is located in form fields then PrintTextLocations is not
going
to be helpful, but you don't need it.
Accessing form fields using PDFBox is very easy. You can use this code
example to print out the field names and their values to the console:

   PDDocument pdfDocument = PDDocument.load(fileName);
   PDDocumentCatalog docCatalog = pdfDocument.getDocumentCatalog();
   PDAcroForm acroForm = docCatalog.getAcroForm();
   List fields = acroForm.getFields();
   Iterator fieldsIter = fields.iterator();
   while (fieldsIter.hasNext()) {
       PDField field = (PDField) fieldsIter.next();
       System.out.println(field.getPartialName() + ":" +
field.getValue());
   }


On Thu, Feb 11, 2016 at 2:32 PM, Al Grant <[email protected]> wrote:

Hello,
I am looking for some help. I am reporting this because I can add some

more

information.

I have a form (a sample of which you can view here :



https://drive.google.com/file/d/0B3rjaapNHpJJa1pfc1l1M2NzSEk/view?usp=sharing

)

Basically the information in the form is tabular. My reading so far
tells
me I should using extract text by area and to get those coordinates
printtextlocations.

If any developers out there are able to help, since my coding skills
are
rusty I would really appreciate it.

Even if it was just a sample of code for one field which I can then
copy
and reuse.

Thanks

-Al


--
"Beat it punk!"
- Clint Eastwood



---------------------------------------------------------------------
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