pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msahy...@apache.org
Subject svn commit: r1827342 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDAbstractContentStream.java
Date Tue, 20 Mar 2018 17:55:31 GMT
Author: msahyoun
Date: Tue Mar 20 17:55:31 2018
New Revision: 1827342

URL: http://svn.apache.org/viewvc?rev=1827342&view=rev
Log:
PDFBOX-4159: throw an exception if special graphics state operationsCare used within text
mode as this is not permitted

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDAbstractContentStream.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDAbstractContentStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDAbstractContentStream.java?rev=1827342&r1=1827341&r2=1827342&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDAbstractContentStream.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDAbstractContentStream.java
Tue Mar 20 17:55:31 2018
@@ -526,6 +526,11 @@ public abstract class PDAbstractContentS
      */
     public void transform(Matrix matrix) throws IOException
     {
+        if (inTextMode)
+        {
+            throw new IllegalStateException("Error: Modifying the current transformation
matrix is not allowed within text objects.");
+        }
+
         writeAffineTransform(matrix.createAffineTransform());
         writeOperator("cm");
     }
@@ -536,6 +541,11 @@ public abstract class PDAbstractContentS
      */
     public void saveGraphicsState() throws IOException
     {
+        if (inTextMode)
+        {
+            throw new IllegalStateException("Error: Saving the graphics state is not allowed
within text objects.");
+        }
+
         if (!fontStack.isEmpty())
         {
             fontStack.push(fontStack.peek());
@@ -557,6 +567,11 @@ public abstract class PDAbstractContentS
      */
     public void restoreGraphicsState() throws IOException
     {
+        if (inTextMode)
+        {
+            throw new IllegalStateException("Error: Restoring the graphics state is not allowed
within text objects.");
+        }
+
         if (!fontStack.isEmpty())
         {
             fontStack.pop();



Mime
View raw message