You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ja...@apache.org on 2014/10/26 02:18:55 UTC
svn commit: r1634263 - in
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox:
contentstream/PDFStreamEngine.java rendering/PageDrawer.java
Author: jahewson
Date: Sun Oct 26 01:18:55 2014
New Revision: 1634263
URL: http://svn.apache.org/r1634263
Log:
PDFBOX-2423: Fix for parent resources and clipping
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java?rev=1634263&r1=1634262&r2=1634263&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java Sun Oct 26 01:18:55 2014
@@ -187,17 +187,6 @@ public class PDFStreamEngine
}
/**
- * Shows a Type 3 character.
- *
- * @param charProc Type 3 character procedure
- * @throws IOException if the character cannot be processed
- */
- public void showType3Character(PDType3CharProc charProc) throws IOException
- {
- processChildStream(charProc);
- }
-
- /**
* Process a child stream of the current page. For use with #processPage(PDPage).
*
* @param contentStream the child content stream
@@ -260,14 +249,15 @@ public class PDFStreamEngine
* Process a content stream.
*
* @param contentStream the content stream
- * @param patternBBox fixme: temporary workaround for tiling patterns
+ * @param patternBBox fixme: temporary workaround for tiling patterns
* @throws IOException if there is an exception while processing the stream
*/
private void processStream(PDContentStream contentStream, PDRectangle patternBBox) throws IOException
{
// resource lookup: first look for stream resources, then fallback to the current page
+ PDResources parentResources = resources;
PDResources streamResources = contentStream.getResources();
- if (contentStream.getResources() != null)
+ if (streamResources != null)
{
resources = streamResources;
}
@@ -285,6 +275,7 @@ public class PDFStreamEngine
if (contentStream != currentPage && bbox != null)
{
Area clip = new Area(new GeneralPath(new Rectangle(bbox.createDimension())));
+ clip.transform(getGraphicsState().getCurrentTransformationMatrix().createAffineTransform());
saveGraphicsState();
getGraphicsState().intersectClippingPath(clip);
}
@@ -326,6 +317,9 @@ public class PDFStreamEngine
restoreGraphicsState();
}
+ // restore page resources
+ resources = parentResources;
+
// fixme: stream matrix
subStreamMatrix = oldSubStreamMatrix;
}
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java?rev=1634263&r1=1634262&r2=1634263&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java Sun Oct 26 01:18:55 2014
@@ -50,7 +50,6 @@ import org.apache.pdfbox.rendering.font.
import org.apache.pdfbox.rendering.font.TTFGlyph2D;
import org.apache.pdfbox.rendering.font.Type1Glyph2D;
import org.apache.pdfbox.pdmodel.PDPage;
-import org.apache.pdfbox.pdmodel.PDResources;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.font.PDFont;
import org.apache.pdfbox.pdmodel.font.PDTrueTypeFont;