From 54b327b3de39e152b18b9c82b8a5b168822a024d Mon Sep 17 00:00:00 2001 From: Tilman Hausherr Date: Fri, 19 Jul 2024 13:08:15 +0000 Subject: [PATCH] PDFBOX-5851: set color and colorspace before setting the path, as suggested by Michael Klink git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1919371 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/pdfbox/examples/pdmodel/CreatePatternsPDF.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePatternsPDF.java b/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePatternsPDF.java index 3f050720b70..f984d2ebb4e 100644 --- a/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePatternsPDF.java +++ b/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreatePatternsPDF.java @@ -80,8 +80,8 @@ public static void main(String[] args) throws IOException PDColor patternColor1 = new PDColor(patternName1, patternCS1); - pcs.addRect(50, 500, 200, 200); pcs.setNonStrokingColor(patternColor1); + pcs.addRect(50, 500, 200, 200); pcs.fill(); // Uncolored pattern - the color is passed later @@ -111,8 +111,8 @@ public static void main(String[] args) throws IOException patternName2, patternCS2); - pcs.addRect(300, 500, 100, 100); pcs.setNonStrokingColor(patternColor2green); + pcs.addRect(300, 500, 100, 100); pcs.fill(); // same pattern again but with different color + different pattern start position @@ -120,11 +120,11 @@ public static void main(String[] args) throws IOException new float[]{0,0,1}, patternName2, patternCS2); - pcs.addRect(455, 505, 100, 100); pcs.setNonStrokingColor(patternColor2blue); + pcs.addRect(455, 505, 100, 100); pcs.fill(); } - doc.save("patterns.pdf"); + doc.save("c:/users/tilman/downloads/patterns.pdf"); } } }