You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Grayson Faircloth <gr...@gmail.com> on 2017/05/03 21:43:30 UTC

Help setting up PDFbox in Eclipse

Hi all,

I recently decided to switch over to Eclipse to develop a program I’m currently working on. I’m not familiar with the environment and would like to figure out out to import the package or do whatever I need to do so I can try the test program found at https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/printing/Printing.java?revision=1792647&view=co <https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/printing/Printing.java?revision=1792647&view=co>
without any errors. I downloaded version 2.0.5 and have everything in the folder it was downloaded in but I’m not sure what to do next. Importing the whole folder into the project didn’t do anything.
One of the error's I am getting is The import org.apache.pdfbox.pdmodel.PDDocument cannot be resolved to a type.

Thanks.

Re: Help setting up PDFbox in Eclipse

Posted by David Patterson <pa...@gmail.com>.
Grayson,

When using Eclipse (my preferred environment), the "cannot be resolved"
message are due to Eclipse not finding the jar files. There are two ways
normally used to provide the jars:

1) make a directory in your project (typically called "lib") and put the
jars there. Then right mouse click on the top name in the Package Explorer
or Project Explorer view and click "Build Path" and then "Configure Build
Path". When you see the dialog box, click the "Libraries" tab and then the
"Add External Jars..." button on the right. Navigate to the folder with the
jars, select them and they will be available for you to use.

or (this is more effort to setup, but results in improvements forever and
is worth the time to setup)

2) convert your project to a Maven project, and add a dependency for
PDFBox, and any additional external projects on which your project depends.
Maven will fetch the code (and the Javadoc and source if you tell Eclipse
you want it to do that). To upgrade to a newer release, change the entry in
the dependency to the new release, save the "pom.xml" file that has the
list of dependencies, and rebuild the project. You now have the new release.

It is non-trivial if you are the only developer around to make your project
into a Maven one, but the payoff is well worth the effort.

Dave Patterson

On Wed, May 3, 2017 at 5:43 PM, Grayson Faircloth <
graysonfaircloth3@gmail.com> wrote:

> Hi all,
>
> I recently decided to switch over to Eclipse to develop a program I’m
> currently working on. I’m not familiar with the environment and would like
> to figure out out to import the package or do whatever I need to do so I
> can try the test program found at https://svn.apache.org/viewvc/
> pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/
> examples/printing/Printing.java?revision=1792647&view=co <
> https://svn.apache.org/viewvc/pdfbox/trunk/examples/
> src/main/java/org/apache/pdfbox/examples/printing/Printing.java?revision=
> 1792647&view=co>
> without any errors. I downloaded version 2.0.5 and have everything in the
> folder it was downloaded in but I’m not sure what to do next. Importing the
> whole folder into the project didn’t do anything.
> One of the error's I am getting is The import org.apache.pdfbox.pdmodel.PDDocument
> cannot be resolved to a type.
>
> Thanks.
>

Re: Help setting up PDFbox in Eclipse

Posted by David Ellis Rogers <da...@gmail.com>.
>   goto   https://www.tutorialspoint.com/pdfbox/index.htm <https://www.tutorialspoint.com/pdfbox/index.htm> fore tutorials.

> On May 3, 2017, at 5:43 PM, Grayson Faircloth <gr...@gmail.com> wrote:
> 
> Hi all,
> 
> I recently decided to switch over to Eclipse to develop a program I’m currently working on. I’m not familiar with the environment and would like to figure out out to import the package or do whatever I need to do so I can try the test program found at https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/printing/Printing.java?revision=1792647&view=co <https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/printing/Printing.java?revision=1792647&view=co>
> without any errors. I downloaded version 2.0.5 and have everything in the folder it was downloaded in but I’m not sure what to do next. Importing the whole folder into the project didn’t do anything.
> One of the error's I am getting is The import org.apache.pdfbox.pdmodel.PDDocument cannot be resolved to a type.
> 
> Thanks.