You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2014/01/11 11:59:17 UTC
svn commit: r1557341 -
/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/PDFImageWriter.java
Author: lehmi
Date: Sat Jan 11 10:59:17 2014
New Revision: 1557341
URL: http://svn.apache.org/r1557341
Log:
PDFBOX-1839: use TYPE_INT_RGB as default image type as proposed by Tilman Hausherr
Modified:
pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/PDFImageWriter.java
Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/PDFImageWriter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/PDFImageWriter.java?rev=1557341&r1=1557340&r2=1557341&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/PDFImageWriter.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/PDFImageWriter.java Sat Jan 11 10:59:17 2014
@@ -30,9 +30,9 @@ import org.apache.pdfbox.pdmodel.PDPage;
/**
* This class writes single pages of a pdf to a file.
- *
+ *
* @author <a href="mailto:DanielWilson@Users.SourceForge.net">Daniel Wilson</a>
- * @version $Revision: 1.1 $
+ *
*/
public class PDFImageWriter extends PDFStreamEngine
{
@@ -65,25 +65,22 @@ public class PDFImageWriter extends PDFS
}
/**
- * Converts a given page range of a PDF document to bitmap images.
- *
- * @param document
- * the PDF document
- * @param imageType
- * the target format (ex. "png")
- * @param password
- * the password (needed if the PDF is encrypted)
- * @param startPage
- * the start page (1 is the first page)
- * @param endPage
- * the end page (set to Integer.MAX_VALUE for all pages)
- * @param outputPrefix
- * used to construct the filename for the individual images
+ * Converts a given page range of a PDF document to bitmap images by calling
+ * {@link writeImage(PDDocument document, String imageFormat, String password, int startPage, int endPage,
+ * String outputPrefix, int imageType, int resolution)} with imageType {@link BufferedImage}.TYPE_INT_RGB
+ * and screen resolution, or 96dpi if screen resolution is unavailable.
+ *
+ * @param document the PDF document
+ * @param imageFormat the target format (ex. "png")
+ * @param password the password (needed if the PDF is encrypted)
+ * @param startPage the start page (1 is the first page)
+ * @param endPage the end page (set to Integer.MAX_VALUE for all pages)
+ * @param outputPrefix used to construct the filename for the individual images
* @return true if the images were produced, false if there was an error
* @throws IOException
* if an I/O error occurs
*/
- public boolean writeImage(PDDocument document, String imageType, String password, int startPage, int endPage,
+ public boolean writeImage(PDDocument document, String imageFormat, String password, int startPage, int endPage,
String outputPrefix) throws IOException
{
int resolution;
@@ -95,7 +92,7 @@ public class PDFImageWriter extends PDFS
{
resolution = 96;
}
- return writeImage(document, imageType, password, startPage, endPage, outputPrefix, 8, resolution);
+ return writeImage(document, imageFormat, password, startPage, endPage, outputPrefix, BufferedImage.TYPE_INT_RGB, resolution);
}
/**