You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2018/12/05 13:24:38 UTC
svn commit: r1848213 -
/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java
Author: tilman
Date: Wed Dec 5 13:24:37 2018
New Revision: 1848213
URL: http://svn.apache.org/viewvc?rev=1848213&view=rev
Log:
PDFBOX-4393: mark updated when applicable; check whether font dictionary exists; avoid bug that wrong dictionary was checked for font
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java?rev=1848213&r1=1848212&r2=1848213&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDAcroForm.java Wed Dec 5 13:24:37 2018
@@ -109,6 +109,7 @@ public final class PDAcroForm implements
if (getDefaultAppearance().length() == 0)
{
setDefaultAppearance(adobeDefaultAppearanceString);
+ dictionary.setNeedToBeUpdated(true);
}
// DR entry is required
@@ -117,19 +118,30 @@ public final class PDAcroForm implements
{
defaultResources = new PDResources();
setDefaultResources(defaultResources);
+ dictionary.setNeedToBeUpdated(true);
}
// Adobe Acrobat uses Helvetica as a default font and
// stores that under the name '/Helv' in the resources dictionary
// Zapf Dingbats is included per default for check boxes and
// radio buttons as /ZaDb.
- if (!defaultResources.getCOSObject().containsKey("Helv"))
+ COSDictionary fontDict = defaultResources.getCOSObject().getCOSDictionary(COSName.FONT);
+ if (fontDict == null)
{
- defaultResources.put(COSName.getPDFName("Helv"), PDType1Font.HELVETICA);
+ fontDict = new COSDictionary();
+ defaultResources.getCOSObject().setItem(COSName.FONT, fontDict);
}
- if (!defaultResources.getCOSObject().containsKey("ZaDb"))
+ if (!fontDict.containsKey(COSName.HELV))
{
- defaultResources.put(COSName.getPDFName("ZaDb"), PDType1Font.ZAPF_DINGBATS);
+ defaultResources.put(COSName.HELV, PDType1Font.HELVETICA);
+ defaultResources.getCOSObject().setNeedToBeUpdated(true);
+ fontDict.setNeedToBeUpdated(true);
+ }
+ if (!fontDict.containsKey(COSName.ZA_DB))
+ {
+ defaultResources.put(COSName.ZA_DB, PDType1Font.ZAPF_DINGBATS);
+ defaultResources.getCOSObject().setNeedToBeUpdated(true);
+ fontDict.setNeedToBeUpdated(true);
}
}