0

I am using Eclipse and java, and have two different projects I am looking at (Workspace 1 and Workspace 2). I am working with PDF Images trying to port something from WS1 to WS2. The code being executed is

PDDocument pdfDocument;
... // Set to a valid PDDocument
page = pdfDocument.getPage(0);

in WS1 this works fine. In WS2, pdfDocument has no getPage() method.

I examined the pom file, and both have the following:

    <dependency>
        <groupId>org.apache.pdfbox</groupId>
        <artifactId>pdfbox</artifactId>
        <version>1.8.10</version>
    </dependency>

I looked at the full path for PDDocument, and for both it is "org.apache.pdfbox.pdmodel.PDDocument".

Since I am using eclipse, I can right click and open a definition, which I did in both workspaces for PDDocument:

WS1

/**
 * This is the in-memory representation of the PDF document.
 * The #close() method must be called once the document is no longer needed.
 * 
 * @author Ben Litchfield
 */
public class PDDocument implements Closeable
{
    private static final Log LOG = 
LogFactory.getLog(PDDocument.class);

WS2:

/**
 * This is the in-memory representation of the PDF document.  You need to call
 * close() on this object when you are done using it!!
 * <p>
 * This class implements the {@link Pageable} interface, but since PDFBox
 * version 1.3.0 you should be using the {@link PDPageable} adapter instead
 * (see <a href="https://issues.apache.org/jira/browse/PDFBOX-788">PDFBOX-788</a>).
 *
 * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
 * @version $Revision: 1.47 $
 */
public class PDDocument implements Pageable, Closeable
{

/**
 * Log instance.
 */

as you can see, these files are different even though their names are the same. I am still sort of new to maven and pom files. I cannot really understand how these can be different or what I should do to get the correct one in WS2. I did maven->update.

Someone will ask what I am trying to accomplish. I am trying to get an array or list or set of all images in a PDF file so I can see whether a specific image is contained in the document. This works fine in WS1.

Any suggestions what to do? I suppose I could email Ben Litchfield ;-)

Tony
  • 1,127
  • 1
  • 18
  • 29
  • In netbeans there is the possibility to show the effective maven pom.xml, is there a similar feature in eclipse? I suspect that the two pom.xml are not identical. The first uses PDFBox 2.0. Maybe there are more dependencies, and one of them gets a newer PDFBox version. – Tilman Hausherr Oct 31 '18 at 08:42
  • https://maven.apache.org/plugins/maven-help-plugin/effective-pom-mojo.html – Tilman Hausherr Oct 31 '18 at 08:49
  • I can view the POM. It has tabs, Overview, Dependencies, Dependency Hierarchy, Effective POM, pom.xml. As I typed this I realized it answered your question ;-) – Tony Oct 31 '18 at 11:29
  • And if you see the effective POM, do you see another PDFBox version than the one you expected (1.8)? – Tilman Hausherr Oct 31 '18 at 13:10
  • 2.0.3 Weird. What is the difference between pom and effective pom? – Tony Oct 31 '18 at 13:20
  • I'm not a maven expert, but IMHO the effective pom shows what version is used through other (outside) dependencies, e.g. parent poms. But maybe read this: https://stackoverflow.com/questions/26114768/what-are-the-difference-between-pom-xml-and-effective-pom-in-apache-maven – Tilman Hausherr Oct 31 '18 at 13:23

0 Answers0