Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-201

Bad file descriptor while saving a document w. imported PDFs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Cannot Reproduce
    • None
    • None
    • Writing
    • None

    Description

      [imported from SourceForge]
      http://sourceforge.net/tracker/index.php?group_id=78314&atid=552832&aid=1563263
      Originally submitted by nobody on 2006-09-21 19:05.

      I believe I've found an error on PDFBox, or at least a
      non-standard behavior.

      I have a PDF Document I create with PDFBox and then
      start importing other PDFs onto it, something like

      for every PDF in PDFLIST
      mainPdf.import(PDF)
      PDF.close

      I can have hundreds of PDFs being imported to the main
      document.

      The thing is that when saving the main Document I
      sometimes get the Bad File Descriptor error.

      To fix it I had to do something ugly like:

      for every PDF in PDFLIST
      mainPdf.import(PDF)
      toBeErasedPDF.add(PDF)

      ...
      mainPdf.save(..)
      mainPdf.close()

      for every PDF in toBeErasedPDF
      PDF.close

      in this way the error goes away but
      A) it took me a whole lot of time to realize this
      B) I am maintaining in memory lots of unused objects
      that could have been GC'd.

      Still, this problem does not always arise.
      I am attaching two different FO's (correct.fo.xml and
      incorrect.fo.xml), where the first one does not show
      this error, and the second one does. I am not attaching
      code because I am not allowed to, but the idea is to
      convert those documents to PDF and add them to the main
      PDF document, separately.

      I really do not know what is causing the problem in one
      doc and not in the other.

      BTW I am using version 0.7.2 (and it also happens in 0.7.1)

      PS: It seems that I can only add one file? I'm adding
      the incorrect one.

      Hope this helps,
      Best Regards
      Andrés Bernasconi

      [attachment on SourceForge]
      http://sourceforge.net/tracker/download.php?group_id=78314&atid=552832&aid=1563263&file_id=194626
      incorrect.fo.xml (text/xml), 29948 bytes
      This FO causes the error mentioned above

      [comment on SourceForge]
      Originally sent by benlitchfield.
      Logged In: YES
      user_id=601708

      Hi Andrés,

      Can you give the nightly build a try
      http://www.pdfbox.org/dist

      I think another user reported this at one point and if I
      remember correctly I couldn't reproduce it, so I think it
      might be fixed in CVS.

      Give it a try and let me know,
      Thanks,
      Ben

      Attachments

        Activity

          People

            lehmi Andreas Lehmkühler
            Anonymous Anonymous
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: