You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (Jira)" <ji...@apache.org> on 2020/05/08 18:32:00 UTC

[jira] [Comment Edited] (PDFBOX-4825) PDPushButton.getOnValues() throws IllegalStateException

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

Tilman Hausherr edited comment on PDFBOX-4825 at 5/8/20, 6:31 PM:
------------------------------------------------------------------

Thank you... this is a Pushbutton, this type of button retains no permanent value, so I think it shouldn't return any "on" values. I think we should add methods in the class to return an empty list for getOnValues() and "" for getOnValue().


was (Author: tilman):
Thank you... this is a Pushbutton, this type of button retains no permanent value, so I think it shouldn't return any "on" values. I think we should change the methods to return an empty list for getOnValues() and "" for getOnValue().

> PDPushButton.getOnValues() throws IllegalStateException
> -------------------------------------------------------
>
>                 Key: PDFBOX-4825
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4825
>             Project: PDFBox
>          Issue Type: Bug
>          Components: AcroForm
>    Affects Versions: 2.0.19, 2.0.20
>         Environment: Windows 10 (v10.0.18363.778)
> openjdk version "11.0.4" 2019-07-16
> OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.4+11)
> OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.4+11, mixed mode)
>            Reporter: Jay Taylor
>            Priority: Minor
>             Fix For: 2.0.20, 3.0.0 PDFBox
>
>         Attachments: testimage.pdf
>
>
> Calling PDPushButton.getOnValues() results in an IllegalStateException in v2.0.19 and v2.0.20-SNAPSHOT). Not sure if prior versions exhibited this error. Line numbers are identical in both tested versions.  
> {code:java}
> java.lang.IllegalStateException: This entry is not an appearance subdictionary
> at org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceEntry.getSubDictionary(PDAppearanceEntry.java:97)
> at org.apache.pdfbox.pdmodel.interactive.form.PDButton.getOnValueForWidget(PDButton.java:349)
> at org.apache.pdfbox.pdmodel.interactive.form.PDButton.getOnValues(PDButton.java:320)
> at AppearanceSubdictionaryError.main(AppearanceSubdictionaryError.java:21){code}
>  
> Sample file attached to issue was created utilizing Adobe Acrobat Standard DC 20.6.20042.
> Sample code to reproduce:
>  
> {code:java}
> import java.io.File;
> import java.io.IOException;
> import org.apache.pdfbox.pdmodel.PDDocument;
> import org.apache.pdfbox.pdmodel.interactive.form.PDField;
> import org.apache.pdfbox.pdmodel.interactive.form.PDPushButton;
> public class AppearanceSubdictionaryError
> {
>     public static void main(String[] args) throws IOException
>     {
>         PDDocument document = null;
>         try
>         {
>             document = PDDocument.load(new File("testimage.pdf"));
>             for (PDField field : document.getDocumentCatalog().getAcroForm().getFields())
>             {
>                 if (field instanceof PDPushButton)
>                 {
>                     ((PDPushButton) field).getOnValues();
>                 }
>             }
>         }
>         catch (Exception e)
>         {
>             e.printStackTrace();
>         }
>         finally
>         {
>             document.close();
>         }
>     }
> }
> {code}
>  
> Ran across this issue when pulling acro field information from a test document. This doesn't affect our use of the project. I am merely reporting it as it seems like it shouldn't happen.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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