You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2019/09/21 12:27:21 UTC
svn commit: r1867280 -
/pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java
Author: tilman
Date: Sat Sep 21 12:27:21 2019
New Revision: 1867280
URL: http://svn.apache.org/viewvc?rev=1867280&view=rev
Log:
PDFBOX-4655: set 0 as default for maximal PNG compression, 1 for maximum quality for the other formats
Modified:
pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java
Modified: pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java?rev=1867280&r1=1867279&r2=1867280&view=diff
==============================================================================
--- pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java (original)
+++ pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java Sat Sep 21 12:27:21 2019
@@ -85,7 +85,7 @@ public final class PDFToImage
int endPage = Integer.MAX_VALUE;
String color = "rgb";
int dpi;
- float quality = 1.0f;
+ float quality = -1;
float cropBoxLowerLeftX = 0;
float cropBoxLowerLeftY = 0;
float cropBoxUpperRightX = 0;
@@ -201,6 +201,10 @@ public final class PDFToImage
{
outputPrefix = pdfFile.substring( 0, pdfFile.lastIndexOf( '.' ));
}
+ if (quality < 0)
+ {
+ quality = "png".equals(imageFormat) ? 0f : 1f;
+ }
PDDocument document = null;
try
@@ -302,7 +306,8 @@ public final class PDFToImage
+ " -endPage <int> : The last page to extract (inclusive)\n"
+ " -color <string> : The color depth (valid: bilevel, gray, rgb (default), rgba)\n"
+ " -dpi <int> : The DPI of the output image, default: screen resolution or 96 if unknown\n"
- + " -quality <float> : The quality to be used when compressing the image (0 < quality <= 1 (default))\n"
+ + " -quality <float> : The quality to be used when compressing the image (0 <= quality <= 1)\n"
+ + " (default: 0 for PNG and 1 for the other formats)\n"
+ " -cropbox <int> <int> <int> <int> : The page area to export\n"
+ " -time : Prints timing information to stdout\n"
+ " -subsampling : Activate subsampling (for PDFs with huge images)\n"