pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1726912 - in /pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel: AddImageToPDF.java AddMessageToEachPage.java CreateGradientShadingPDF.java CreateLandscapePDF.java UsingTextMatrix.java
Date Tue, 26 Jan 2016 21:43:16 GMT
Author: tilman
Date: Tue Jan 26 21:43:16 2016
New Revision: 1726912

URL: http://svn.apache.org/viewvc?rev=1726912&view=rev
Log:
PDFBOX-3084: replace deprecated calls

Modified:
    pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/AddImageToPDF.java
    pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/AddMessageToEachPage.java
    pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreateGradientShadingPDF.java
    pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreateLandscapePDF.java
    pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/UsingTextMatrix.java

Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/AddImageToPDF.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/AddImageToPDF.java?rev=1726912&r1=1726911&r2=1726912&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/AddImageToPDF.java
(original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/AddImageToPDF.java
Tue Jan 26 21:43:16 2016
@@ -21,6 +21,7 @@ import java.io.IOException;
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.PDPage;
 import org.apache.pdfbox.pdmodel.PDPageContentStream;
+import org.apache.pdfbox.pdmodel.PDPageContentStream.AppendMode;
 import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;
 
 /**
@@ -57,7 +58,7 @@ public class AddImageToPDF
             // if you already have the image in a BufferedImage, 
             // call LosslessFactory.createFromImage() instead
             PDImageXObject pdImage = PDImageXObject.createFromFile(imagePath, doc);
-            PDPageContentStream contentStream = new PDPageContentStream(doc, page, true,
true);
+            PDPageContentStream contentStream = new PDPageContentStream(doc, page, AppendMode.APPEND,
true);
 
             // contentStream.drawImage(ximage, 20, 20 );
             // better method inspired by http://stackoverflow.com/a/22318681/535646

Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/AddMessageToEachPage.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/AddMessageToEachPage.java?rev=1726912&r1=1726911&r2=1726912&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/AddMessageToEachPage.java
(original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/AddMessageToEachPage.java
Tue Jan 26 21:43:16 2016
@@ -23,6 +23,7 @@ import org.apache.pdfbox.pdmodel.PDDocum
 import org.apache.pdfbox.pdmodel.PDPage;
 import org.apache.pdfbox.pdmodel.common.PDRectangle;
 import org.apache.pdfbox.pdmodel.PDPageContentStream;
+import org.apache.pdfbox.pdmodel.PDPageContentStream.AppendMode;
 import org.apache.pdfbox.pdmodel.font.PDFont;
 import org.apache.pdfbox.pdmodel.font.PDType1Font;
 import org.apache.pdfbox.util.Matrix;
@@ -75,7 +76,7 @@ public class AddMessageToEachPage
                 float centerX = rotate ? pageHeight/2f : (pageWidth - stringWidth)/2f;
                 float centerY = rotate ? (pageWidth - stringWidth)/2f : pageHeight/2f;
                 // append the content to the existing stream
-                PDPageContentStream contentStream = new PDPageContentStream(doc, page, true,
true,true);
+                PDPageContentStream contentStream = new PDPageContentStream(doc, page, AppendMode.APPEND,
true, true);
                 contentStream.beginText();
                 // set font and font size
                 contentStream.setFont( font, fontSize );

Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreateGradientShadingPDF.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreateGradientShadingPDF.java?rev=1726912&r1=1726911&r2=1726912&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreateGradientShadingPDF.java
(original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/CreateGradientShadingPDF.java
Tue Jan 26 21:43:16 2016
@@ -28,6 +28,7 @@ import org.apache.pdfbox.pdmodel.PDDocum
 import org.apache.pdfbox.pdmodel.PDPage;
 import org.apache.pdfbox.pdmodel.common.function.PDFunctionType2;
 import org.apache.pdfbox.pdmodel.PDPageContentStream;
+import org.apache.pdfbox.pdmodel.PDPageContentStream.AppendMode;
 import org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB;
 import org.apache.pdfbox.pdmodel.graphics.shading.PDShading;
 import org.apache.pdfbox.pdmodel.graphics.shading.PDShadingType2;
@@ -108,7 +109,7 @@ public class CreateGradientShadingPDF
 
             // invoke shading from content stream
             // compress parameter is set to false so that you can see the stream in a text
editor
-            PDPageContentStream contentStream = new PDPageContentStream(document, page, true,
false);
+            PDPageContentStream contentStream = new PDPageContentStream(document, page, AppendMode.APPEND,
false);
             contentStream.shadingFill(axialShading);
             contentStream.shadingFill(radialShading);
             contentStream.close();

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=1726912&r1=1726911&r2=1726912&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
Tue Jan 26 21:43:16 2016
@@ -22,6 +22,7 @@ import org.apache.pdfbox.pdmodel.PDDocum
 import org.apache.pdfbox.pdmodel.PDPage;
 import org.apache.pdfbox.pdmodel.common.PDRectangle;
 import org.apache.pdfbox.pdmodel.PDPageContentStream;
+import org.apache.pdfbox.pdmodel.PDPageContentStream.AppendMode;
 import org.apache.pdfbox.pdmodel.font.PDFont;
 import org.apache.pdfbox.pdmodel.font.PDType1Font;
 import org.apache.pdfbox.util.Matrix;
@@ -65,7 +66,7 @@ public class CreateLandscapePDF
             float stringWidth = font.getStringWidth( message )*fontSize/1000f;
             float startX = 100;
             float startY = 100;
-            PDPageContentStream contentStream = new PDPageContentStream(doc, page, false,
false);
+            PDPageContentStream contentStream = new PDPageContentStream(doc, page, AppendMode.OVERWRITE,
false);
             // add the rotation using the current transformation matrix
             // including a translation of pageWidth to use the lower left corner as 0,0 reference
             contentStream.transform(new Matrix(0, 1, -1, 0, pageWidth, 0));

Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/UsingTextMatrix.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/UsingTextMatrix.java?rev=1726912&r1=1726911&r2=1726912&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/UsingTextMatrix.java
(original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/UsingTextMatrix.java
Tue Jan 26 21:43:16 2016
@@ -22,6 +22,7 @@ import org.apache.pdfbox.pdmodel.PDDocum
 import org.apache.pdfbox.pdmodel.PDPage;
 import org.apache.pdfbox.pdmodel.common.PDRectangle;
 import org.apache.pdfbox.pdmodel.PDPageContentStream;
+import org.apache.pdfbox.pdmodel.PDPageContentStream.AppendMode;
 import org.apache.pdfbox.pdmodel.font.PDFont;
 import org.apache.pdfbox.pdmodel.font.PDType1Font;
 import org.apache.pdfbox.util.Matrix;
@@ -66,7 +67,7 @@ public class UsingTextMatrix
             float stringWidth = font.getStringWidth( message );
             float centeredYPosition = (pageSize.getHeight() - (stringWidth*fontSize)/1000f)/3f;
 
-            PDPageContentStream contentStream = new PDPageContentStream(doc, page, false,
false);
+            PDPageContentStream contentStream = new PDPageContentStream(doc, page, AppendMode.OVERWRITE,
false);
             contentStream.setFont( font, fontSize );
             contentStream.beginText();
             // counterclockwise rotation
@@ -92,7 +93,7 @@ public class UsingTextMatrix
             doc.addPage(page);
             fontSize = 1.0f;
 
-            contentStream = new PDPageContentStream(doc, page, false, false);
+            contentStream = new PDPageContentStream(doc, page, AppendMode.OVERWRITE, false);
             contentStream.setFont( font, fontSize );
             contentStream.beginText();
 
@@ -110,7 +111,7 @@ public class UsingTextMatrix
             doc.addPage(page);
             fontSize = 1.0f;
 
-            contentStream = new PDPageContentStream(doc, page, false, false);
+            contentStream = new PDPageContentStream(doc, page, AppendMode.OVERWRITE, false);
             contentStream.setFont( font, fontSize );
             contentStream.beginText();
 



Mime
View raw message