[jira] [Commented] (PDFBOX-4204) Problem when merging PDF 1.4 and PDF 1.1 Documents

2018-05-17 Thread ASF subversion and git services (JIRA)

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

ASF subversion and git services commented on PDFBOX-4204:
-

Commit 1831819 from [~tilman] in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1831819 ]

PDFBOX-4204: ignore all illegal OpenAction types

> Problem when merging PDF 1.4 and PDF 1.1 Documents
> --
>
> Key: PDFBOX-4204
> URL: https://issues.apache.org/jira/browse/PDFBOX-4204
> Project: PDFBox
>  Issue Type: Bug
>  Components: Parsing
>Affects Versions: 2.0.9
>Reporter: Christian Lauer
>Priority: Major
>
> Merging PDF 1.1 document with other Version (i.e. PDF 1.4) ends up with 
> following exception: java.io.IOException: Unknown OpenAction COSInt\{26}.
> Here's the referring stack trace
> {code:java}
> Alias: PBOX29: Enter the username:  [guest] java.io.IOException: Unknown 
> OpenAction COSInt{26}
> at 
> org.apache.pdfbox.pdmodel.PDDocumentCatalog.getOpenAction(PDDocumentCatalog.java:279)
> at 
> org.apache.pdfbox.multipdf.PDFMergerUtility.appendDocument(PDFMergerUtility.java:348)
> at 
> org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:263)
> {code}
>  
> To fix this issue COSInteger should be handled in PDDocumentCatalog's 
> getOpenAction method. Our tests showed that returning “null” results in 
> correctly merged document.
> Here is our suggestion for the fixed method:
> {code:java}
> public PDDestinationOrAction getOpenAction() throws IOException {
>COSBase openAction = this.root.getDictionaryObject(COSName.OPEN_ACTION);
>if (openAction == null) {
>  return null;
>} else if (openAction instanceof COSBoolean) {
>  if (!((COSBoolean) openAction).getValue()) {
>return null;
>  } else {
>throw new IOException("Can't create OpenAction from COSBoolean");
>  }
>   } else if (openAction instanceof COSInteger) {
>  return null;  
>} else if (openAction instanceof COSDictionary) {
>  return PDActionFactory.createAction((COSDictionary)openAction);
>} else if (openAction instanceof COSArray) {
>  return PDDestination.create(openAction);
>} else {
>  throw new IOException("Unknown OpenAction " + openAction);
>}
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (PDFBOX-4204) Problem when merging PDF 1.4 and PDF 1.1 Documents

2018-05-17 Thread ASF subversion and git services (JIRA)

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

ASF subversion and git services commented on PDFBOX-4204:
-

Commit 1831818 from [~tilman] in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1831818 ]

PDFBOX-4204: ignore all illegal OpenAction types

> Problem when merging PDF 1.4 and PDF 1.1 Documents
> --
>
> Key: PDFBOX-4204
> URL: https://issues.apache.org/jira/browse/PDFBOX-4204
> Project: PDFBox
>  Issue Type: Bug
>  Components: Parsing
>Affects Versions: 2.0.9
>Reporter: Christian Lauer
>Priority: Major
>
> Merging PDF 1.1 document with other Version (i.e. PDF 1.4) ends up with 
> following exception: java.io.IOException: Unknown OpenAction COSInt\{26}.
> Here's the referring stack trace
> {code:java}
> Alias: PBOX29: Enter the username:  [guest] java.io.IOException: Unknown 
> OpenAction COSInt{26}
> at 
> org.apache.pdfbox.pdmodel.PDDocumentCatalog.getOpenAction(PDDocumentCatalog.java:279)
> at 
> org.apache.pdfbox.multipdf.PDFMergerUtility.appendDocument(PDFMergerUtility.java:348)
> at 
> org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:263)
> {code}
>  
> To fix this issue COSInteger should be handled in PDDocumentCatalog's 
> getOpenAction method. Our tests showed that returning “null” results in 
> correctly merged document.
> Here is our suggestion for the fixed method:
> {code:java}
> public PDDestinationOrAction getOpenAction() throws IOException {
>COSBase openAction = this.root.getDictionaryObject(COSName.OPEN_ACTION);
>if (openAction == null) {
>  return null;
>} else if (openAction instanceof COSBoolean) {
>  if (!((COSBoolean) openAction).getValue()) {
>return null;
>  } else {
>throw new IOException("Can't create OpenAction from COSBoolean");
>  }
>   } else if (openAction instanceof COSInteger) {
>  return null;  
>} else if (openAction instanceof COSDictionary) {
>  return PDActionFactory.createAction((COSDictionary)openAction);
>} else if (openAction instanceof COSArray) {
>  return PDDestination.create(openAction);
>} else {
>  throw new IOException("Unknown OpenAction " + openAction);
>}
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (PDFBOX-4204) Problem when merging PDF 1.4 and PDF 1.1 Documents

2018-04-20 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr commented on PDFBOX-4204:
-

But for your fixed method, you still throw an exception... I think we should 
return null for all illegal values, as we do for other methods.

> Problem when merging PDF 1.4 and PDF 1.1 Documents
> --
>
> Key: PDFBOX-4204
> URL: https://issues.apache.org/jira/browse/PDFBOX-4204
> Project: PDFBox
>  Issue Type: Bug
>  Components: Parsing
>Affects Versions: 2.0.9
>Reporter: Christian Lauer
>Priority: Major
>
> Merging PDF 1.1 document with other Version (i.e. PDF 1.4) ends up with 
> following exception: java.io.IOException: Unknown OpenAction COSInt\{26}.
> Here's the referring stack trace
> {code:java}
> Alias: PBOX29: Enter the username:  [guest] java.io.IOException: Unknown 
> OpenAction COSInt{26}
> at 
> org.apache.pdfbox.pdmodel.PDDocumentCatalog.getOpenAction(PDDocumentCatalog.java:279)
> at 
> org.apache.pdfbox.multipdf.PDFMergerUtility.appendDocument(PDFMergerUtility.java:348)
> at 
> org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:263)
> {code}
>  
> To fix this issue COSInteger should be handled in PDDocumentCatalog's 
> getOpenAction method. Our tests showed that returning “null” results in 
> correctly merged document.
> Here is our suggestion for the fixed method:
> {code:java}
> public PDDestinationOrAction getOpenAction() throws IOException {
>COSBase openAction = this.root.getDictionaryObject(COSName.OPEN_ACTION);
>if (openAction == null) {
>  return null;
>} else if (openAction instanceof COSBoolean) {
>  if (!((COSBoolean) openAction).getValue()) {
>return null;
>  } else {
>throw new IOException("Can't create OpenAction from COSBoolean");
>  }
>   } else if (openAction instanceof COSInteger) {
>  return null;  
>} else if (openAction instanceof COSDictionary) {
>  return PDActionFactory.createAction((COSDictionary)openAction);
>} else if (openAction instanceof COSArray) {
>  return PDDestination.create(openAction);
>} else {
>  throw new IOException("Unknown OpenAction " + openAction);
>}
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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