You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Maruan Sahyoun (Jira)" <ji...@apache.org> on 2022/09/16 06:30:00 UTC

[jira] [Comment Edited] (PDFBOX-5513) getPageLayout throws IllegalArgumentException for empty mode

    [ https://issues.apache.org/jira/browse/PDFBOX-5513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17605632#comment-17605632 ] 

Maruan Sahyoun edited comment on PDFBOX-5513 at 9/16/22 6:29 AM:
-----------------------------------------------------------------

What's your proposal?

- no page mode et all or empty -> SinglePage
- one of the pages modes defined -> return the PageMode
- not empty but none of the defined ones -> exception

?

Added note -  one can always check the value using the COS model.

BR
Maruan


was (Author: msahyoun):
What's your proposal in such cases?

- no page mode et all or empty -> SinglePage
- one of the pages modes defined -> return the PageMode
- not empty but none of the defined ones -> exception

?

BR
Maruan

> getPageLayout throws IllegalArgumentException for empty mode
> ------------------------------------------------------------
>
>                 Key: PDFBOX-5513
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5513
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.25, 2.0.26, 3.0.0 PDFBox
>            Reporter: Karol Bryd
>            Assignee: Tilman Hausherr
>            Priority: Major
>             Fix For: 2.0.27, 3.0.0 PDFBox
>
>         Attachments: page_layout_issue.patch
>
>
> 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.{color:#9876aa}SINGLE_PAGE {color}mode.{color:#9876aa}
> {color}
>  
> 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.
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org