pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1634252 [3/3] - in /pdfbox/trunk: examples/src/main/java/org/apache/pdfbox/examples/pdmodel/ examples/src/main/java/org/apache/pdfbox/examples/util/ pdfbox/src/main/java/org/apache/pdfbox/contentstream/ pdfbox/src/main/java/org/apache/pdfb...
Date Sat, 25 Oct 2014 20:40:17 GMT
Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java?rev=1634252&r1=1634251&r2=1634252&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java (original)
+++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java Sat Oct 25 20:40:16
2014
@@ -325,17 +325,15 @@ public class PDFToImage
 
     private static void changeCropBox(PDDocument document, float a, float b, float c, float
d)
     {
-        List pages = document.getDocumentCatalog().getAllPages();
-        for( int i = 0; i < pages.size(); i++ )
+        for (PDPage page : document.getPages())
         {
-              System.out.println("resizing page");
-              PDPage page = (PDPage)pages.get( i );
-              PDRectangle rectangle = new PDRectangle();
-              rectangle.setLowerLeftX(a);
-              rectangle.setLowerLeftY(b);
-              rectangle.setUpperRightX(c);
-              rectangle.setUpperRightY(d);
-              page.setCropBox(rectangle);
+            System.out.println("resizing page");
+            PDRectangle rectangle = new PDRectangle();
+            rectangle.setLowerLeftX(a);
+            rectangle.setLowerLeftY(b);
+            rectangle.setUpperRightX(c);
+            rectangle.setUpperRightY(d);
+            page.setCropBox(rectangle);
 
         }
     }

Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/gui/PDFPagePanel.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/gui/PDFPagePanel.java?rev=1634252&r1=1634251&r2=1634252&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/gui/PDFPagePanel.java (original)
+++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/gui/PDFPagePanel.java Sat Oct
25 20:40:16 2014
@@ -59,9 +59,9 @@ public class PDFPagePanel extends JPanel
         this.page = page;
         this.pageNum = pageNum;
 
-        PDRectangle cropBox = page.findCropBox();
+        PDRectangle cropBox = page.getCropBox();
         drawDimension = cropBox.createDimension();
-        int rotation = page.findRotation();
+        int rotation = page.getRotation();
         if (rotation == 90 || rotation == 270)
         {
             pageDimension = new Dimension(drawDimension.height, drawDimension.width);

Modified: pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/TestTextToPdf.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/TestTextToPdf.java?rev=1634252&r1=1634251&r2=1634252&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/TestTextToPdf.java (original)
+++ pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/TestTextToPdf.java Sat Oct 25
20:40:16 2014
@@ -56,10 +56,9 @@ public class TestTextToPdf extends TestC
 
         // In order for the PDF document to be openable by Adobe Reader, it needs
         // to have some pages in it. So we'll check that.
-        PDDocumentCatalog docCatalog = pdfDoc.getDocumentCatalog();
-        List allPages = docCatalog.getAllPages();
-        assertNotNull("All Pages was unexpectedly null.", allPages);
-        assertEquals("Wrong number of pages.", 1, allPages.size());
+        int pageCount = pdfDoc.getNumberOfPages();
+        assertNotNull("All Pages was unexpectedly zero.", pageCount);
+        assertEquals("Wrong number of pages.", 1, pageCount);
         pdfDoc.close();
     }
 

Modified: pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/imageio/TestImageIOUtils.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/imageio/TestImageIOUtils.java?rev=1634252&r1=1634251&r2=1634252&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/imageio/TestImageIOUtils.java
(original)
+++ pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/imageio/TestImageIOUtils.java
Sat Oct 25 20:40:16 2014
@@ -27,7 +27,6 @@ import java.io.FilenameFilter;
 import java.io.IOException;
 import java.util.HashSet;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Set;
 import javax.imageio.ImageIO;
 import javax.imageio.ImageReader;
@@ -40,7 +39,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.pdmodel.PDDocument;
-import org.apache.pdfbox.pdmodel.PDPage;
 import org.apache.pdfbox.pdmodel.PDResources;
 import org.apache.pdfbox.pdmodel.graphics.PDXObject;
 import org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject;
@@ -113,8 +111,7 @@ public class TestImageIOUtils extends Te
             document = PDDocument.load(file);
 
             // Save image resources of first page
-            List<PDPage> pdPages = document.getDocumentCatalog().getAllPages();
-            checkSaveResources(pdPages.get(0).getResources());
+            checkSaveResources(document.getPage(0).getResources());
 
             // testing PNG
             writeImage(document, imageType, outDir + file.getName() + "-", ImageType.RGB,
dpi);



Mime
View raw message