|
26 | 26 | import com.itextpdf.text.DocumentException; |
27 | 27 | import com.itextpdf.text.pdf.ByteBuffer; |
28 | 28 | import com.itextpdf.text.pdf.PdfContentByte; |
| 29 | +import com.itextpdf.awt.PdfGraphics2D; |
29 | 30 | import com.itextpdf.text.pdf.PdfWriter; |
30 | 31 | import java.awt.Font; |
31 | 32 | import java.awt.Graphics2D; |
@@ -67,7 +68,7 @@ public class PGraphicsPDF extends PGraphicsJava2D { |
67 | 68 | protected Document document; |
68 | 69 | protected PdfWriter writer; |
69 | 70 | protected PdfContentByte content; |
70 | | - |
| 71 | + protected PdfGraphics2D graphicContent; |
71 | 72 | /** |
72 | 73 | * Shared across instances because it's incredibly time-consuming to create. |
73 | 74 | */ |
@@ -165,7 +166,7 @@ public void beginDraw() { |
165 | 166 |
|
166 | 167 | } |
167 | 168 |
|
168 | | - g2 = content.createGraphicsShapes(width, height); |
| 169 | + g2 = new PdfGraphics2D(content, width, height); |
169 | 170 | } |
170 | 171 |
|
171 | 172 | // super in Java2D now creates an image buffer, don't do that |
@@ -249,9 +250,9 @@ public void nextPage() { |
249 | 250 |
|
250 | 251 | protected Graphics2D createGraphics() { |
251 | 252 | if (textMode == SHAPE) { |
252 | | - return content.createGraphics(width, height); |
| 253 | + return new PdfGraphics2D(content, width, height); |
253 | 254 | } else if (textMode == MODEL) { |
254 | | - return content.createGraphics(width, height, getMapper()); |
| 255 | + return new PdfGraphics2D(content, width, height, getMapper()); |
255 | 256 | } |
256 | 257 | // Should not be reachable... |
257 | 258 | throw new RuntimeException("Invalid textMode() selected for PDF."); |
|
0 commit comments