Skip to content

Commit 0b735bc

Browse files
committed
Avoid deprectated methods
1 parent df51d33 commit 0b735bc

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/main/java/processing/pdf/PGraphicsPDF.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.itextpdf.text.DocumentException;
2727
import com.itextpdf.text.pdf.ByteBuffer;
2828
import com.itextpdf.text.pdf.PdfContentByte;
29+
import com.itextpdf.awt.PdfGraphics2D;
2930
import com.itextpdf.text.pdf.PdfWriter;
3031
import java.awt.Font;
3132
import java.awt.Graphics2D;
@@ -67,7 +68,7 @@ public class PGraphicsPDF extends PGraphicsJava2D {
6768
protected Document document;
6869
protected PdfWriter writer;
6970
protected PdfContentByte content;
70-
71+
protected PdfGraphics2D graphicContent;
7172
/**
7273
* Shared across instances because it's incredibly time-consuming to create.
7374
*/
@@ -165,7 +166,7 @@ public void beginDraw() {
165166

166167
}
167168

168-
g2 = content.createGraphicsShapes(width, height);
169+
g2 = new PdfGraphics2D(content, width, height);
169170
}
170171

171172
// super in Java2D now creates an image buffer, don't do that
@@ -249,9 +250,9 @@ public void nextPage() {
249250

250251
protected Graphics2D createGraphics() {
251252
if (textMode == SHAPE) {
252-
return content.createGraphics(width, height);
253+
return new PdfGraphics2D(content, width, height);
253254
} else if (textMode == MODEL) {
254-
return content.createGraphics(width, height, getMapper());
255+
return new PdfGraphics2D(content, width, height, getMapper());
255256
}
256257
// Should not be reachable...
257258
throw new RuntimeException("Invalid textMode() selected for PDF.");

0 commit comments

Comments
 (0)