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

getPageLayout throws IllegalArgumentException for empty mode

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.25, 2.0.26, 3.0.0 PDFBox
    • 2.0.27, 3.0.0 PDFBox
    • PDModel
    • None
    • Patch

    Description

      getPageLayout() method in PDDocumentCatalog can throw an exception IllegalArgumentException when the PageLayout mode is not one of defined in the PageLayout class. In my case the mode is simply an empty string.The PDF documents which contain such unexpected Page Layout value are all rendered by quite old Adobe PDF library 7.0 from 2014 (I can't share the document, it is confidential....).

      My suggestion is to modify the method so that, similarly to getPageMode() method, the eventual exception is caught and the method returns the default PageLayout.SINGLE_PAGE mode.

       

      This problem affects the current version in trunk, as well as at least 2.0.25 and 2.0.26.

       

      I have created very simple patch which fixes the problem, please consider applying it to the trunk and 2.0.x branch.

       

       

      Attachments

        1. page_layout_issue.patch
          1 kB
          Karol Bryd

        Activity

          People

            tilman Tilman Hausherr
            karolbe Karol Bryd
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: