Results 1 to 7 of 7
  1. #1
    biguglyjim is offline Member
    Join Date
    Jun 2011
    Posts
    4
    Rep Power
    0

    Default Problem with PDFBox loading

    I have written a very simple PDF parser, and it works just fine on the PDF files I have used for testing. I installed it at the client and it still works fine, but they have started using it against their PDF files, and errors are happening. The files are larger and more graphically intense, but still regular old PDF files. My tool doesn't strip text or do anything special, it just grabs whatever pages they request and creates a new PDF file. The files they are using are larger, but not excessively large, in the area of 6k.

    I am using the following code:

    // grab the file
    File input = new File(fpath);

    // load the PDF as a PDDocument -- This does NOT throw an error
    PDDocument original = PDDocument.load(input);

    // This line prints out that the file exists
    System.out.println("exists? " + input.exists());

    // This returns Total number of pages: 0
    // It should return 136
    System.out.println("Total number of pages: " + original.getDocumentCatalog().getAllPages().size() );

    Any thoughts? I can't seem to find any explanations on why it is loading a valid file and not picking up the details. If I open the PDF file from that URL I can view it just fine. This is running on Solaris with iPlanet (though that shouldn't impact anything presumably) and PDFBox 1.5.

    I cannot include PDF files, as they are private information. I recognize that makes this harder to troubleshoot, but I'm hoping for someone to have a similar experience that I can maybe work with.

  2. #2
    biguglyjim is offline Member
    Join Date
    Jun 2011
    Posts
    4
    Rep Power
    0

    Default

    I opened up the PDF properties and noticed that there was no title or author set. I don't imagine that is the issue, but thought I'd mention it.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,442
    Rep Power
    18

    Default

    "errors are happening"
    What errors?

  4. #4
    biguglyjim is offline Member
    Join Date
    Jun 2011
    Posts
    4
    Rep Power
    0

    Default

    Sorry, should have been more explicit. It's not an error or an exception, just that the page count returns 0 when it should be 136.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,442
    Rep Power
    18

    Default

    What does getNumberOfPages() give you?
    Not via the document catalog.

  6. #6
    biguglyjim is offline Member
    Join Date
    Jun 2011
    Posts
    4
    Rep Power
    0

    Default

    Problem resolved. The client had the file locked on his desktop. Sigh. Thanks for the assistance!

  7. #7
    srm
    srm is offline Member
    Join Date
    Sep 2013
    Posts
    1
    Rep Power
    0

    Default Re: Problem with PDFBox loading

    Quote Originally Posted by biguglyjim View Post
    Problem resolved. The client had the file locked on his desktop. Sigh. Thanks for the assistance!
    I want to write a pdf modifier as well but I can't show pdf file in my Jframe how could i do it?

Similar Threads

  1. Problem with loading driver
    By b01g in forum New To Java
    Replies: 7
    Last Post: 07-15-2011, 06:41 PM
  2. Image Loading Problem
    By vimalaranjan in forum Java 2D
    Replies: 1
    Last Post: 05-05-2011, 09:04 PM
  3. PDFBox: Problem with converting pdf page into image
    By artfhc in forum Advanced Java
    Replies: 1
    Last Post: 01-03-2011, 07:37 PM
  4. Problem loading an Image
    By onesixtyfourth in forum Java 2D
    Replies: 1
    Last Post: 10-17-2010, 11:32 AM
  5. Problem with loading image
    By m00nchile in forum New To Java
    Replies: 5
    Last Post: 05-25-2010, 01:34 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •