pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1866756 - /pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java
Date Tue, 10 Sep 2019 16:28:51 GMT
Author: tilman
Date: Tue Sep 10 16:28:51 2019
New Revision: 1866756

URL: http://svn.apache.org/viewvc?rev=1866756&view=rev
Log:
PDFBOX-4646: refresh appearances if /NeedAppearances is set

Modified:
    pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java

Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java?rev=1866756&r1=1866755&r2=1866756&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java (original)
+++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java Tue Sep 10 16:28:51
2019
@@ -27,6 +27,7 @@ import javax.imageio.ImageIO;
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.PDPage;
 import org.apache.pdfbox.pdmodel.common.PDRectangle;
+import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
 import org.apache.pdfbox.rendering.ImageType;
 import org.apache.pdfbox.rendering.PDFRenderer;
 import org.apache.pdfbox.tools.imageio.ImageIOUtil;
@@ -196,6 +197,11 @@ public final class PDFToImage
 
             try (PDDocument document = PDDocument.load(new File(pdfFile), password))
             {
+                PDAcroForm acroForm = document.getDocumentCatalog().getAcroForm();
+                if (acroForm != null && acroForm.getNeedAppearances())
+                {
+                    acroForm.refreshAppearances();
+                }
                 ImageType imageType = null;
                 if ("bilevel".equalsIgnoreCase(color))
                 {



Mime
View raw message