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

Getting IllegalArgumentException when extracting telemetry from PDF: PDLayoutDontCare

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0.17, 2.0.18, 2.0.19
    • None
    • PDModel
    • None

    Description

      Given the following code

      val catalog: PDDocumentCatalog = pdf.getDocumentCatalog
      catalog.getPageLayout
      

       

      For a specific document, catalog.getPageLayout throws an IllegalArgumentException with the following trace

       

       

      Error Detail:java.lang.IllegalArgumentException: PDLayoutDontCare
      at org.apache.pdfbox.pdmodel.PageLayout.fromString(PageLayout.java:54)
      at org.apache.pdfbox.pdmodel.PDDocumentCatalog.getPageLayout(PDDocumentCatalog.java:479)
      

       

      Looking at the source code for PageLayout we have the following values

      SINGLE_PAGE("SinglePage"),
      
      /**  Display the pages in one column. */
      ONE_COLUMN("OneColumn"),
      
      /** Display the pages in two columns), with odd numbered pages on the left. */
      TWO_COLUMN_LEFT("TwoColumnLeft"),
      
      /** Display the pages in two columns), with odd numbered pages on the right.  */
      TWO_COLUMN_RIGHT("TwoColumnRight"),
      
      /** Display the pages two at a time), with odd-numbered pages on the left. */
      TWO_PAGE_LEFT("TwoPageLeft"),
      
      /** Display the pages two at a time), with odd-numbered pages on the right. */
      TWO_PAGE_RIGHT("TwoPageRight");
      

      The PDLayoutDontCare option is not present. However according to the pdf spec it is a valid value

       

      https://help.adobe.com/pdfl_sdk/15/PDFL_SDK_HTMLHelp/PDFL_SDK_HTMLHelp/API_References/PDFL_API_Reference/PD_Layer/General.html#PDLayoutModePDLayoutDontCare

       

      Can you please fix this case?

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            bettori Benjamin Ettori
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: