pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1649985 - /pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreateLandscapePDF.java
Date Wed, 07 Jan 2015 02:10:51 GMT
Author: jahewson
Date: Wed Jan  7 02:10:51 2015
New Revision: 1649985

URL: http://svn.apache.org/r1649985
Log:
PDFBOX-2590: Simplify path drawing API

Modified:
    pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreateLandscapePDF.java

Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreateLandscapePDF.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreateLandscapePDF.java?rev=1649985&r1=1649984&r2=1649985&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreateLandscapePDF.java
(original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreateLandscapePDF.java
Wed Jan  7 02:10:51 2015
@@ -18,6 +18,7 @@ package org.apache.pdfbox.examples.pdmod
 
 import java.io.IOException;
 
+import org.apache.pdfbox.contentstream.PDContentStream;
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.PDPage;
 import org.apache.pdfbox.pdmodel.common.PDRectangle;
@@ -79,11 +80,23 @@ public class CreateLandscapePDF
             contentStream.newLineAtOffset(100, 100);
             contentStream.showText(message);
             contentStream.endText();
-            
-            contentStream.drawLine(startX-2, startY-2, startX-2, startY+200+fontSize);
-            contentStream.drawLine(startX-2, startY+200+fontSize, startX+100+stringWidth+2,
startY+200+fontSize);
-            contentStream.drawLine(startX+100+stringWidth+2, startY+200+fontSize, startX+100+stringWidth+2,
startY-2);
-            contentStream.drawLine(startX+100+stringWidth+2, startY-2, startX-2, startY-2);
+
+            contentStream.moveTo(startX-2, startY-2);
+            contentStream.lineTo(startX-2, startY+200+fontSize);
+            contentStream.stroke();
+
+            contentStream.moveTo(startX-2, startY+200+fontSize);
+            contentStream.lineTo(startX+100+stringWidth+2, startY+200+fontSize);
+            contentStream.stroke();
+
+            contentStream.moveTo(startX+100+stringWidth+2, startY+200+fontSize);
+            contentStream.lineTo(startX+100+stringWidth+2, startY-2);
+            contentStream.stroke();
+
+            contentStream.moveTo(startX+100+stringWidth+2, startY-2);
+            contentStream.lineTo(startX-2, startY-2);
+            contentStream.stroke();
+
             contentStream.close();
 
             doc.save( outfile );



Mime
View raw message