You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Jay Taylor (Jira)" <ji...@apache.org> on 2020/05/08 18:09:00 UTC
[jira] [Created] (PDFBOX-4825) PDPushButton.getOnValues() throws
IllegalStateException
Jay Taylor created PDFBOX-4825:
----------------------------------
Summary: 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
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