Only in poppler-0.24.1-new: diff diff -rup poppler-0.24.1/poppler/GfxState.h poppler-0.24.1-new/poppler/GfxState.h --- poppler-0.24.1/poppler/GfxState.h 2013-08-19 01:31:02.000000000 +0400 +++ poppler-0.24.1-new/poppler/GfxState.h 2013-08-29 18:06:28.125000000 +0400 @@ -103,7 +103,7 @@ static inline double colToDbl(GfxColorCo } static inline Guchar dblToByte(double x) { - return (x * 255.0); + return (Guchar)(x * 255.0); } static inline double byteToDbl(Guchar x) { diff -rup poppler-0.24.1/poppler/GlobalParams.cc poppler-0.24.1-new/poppler/GlobalParams.cc --- poppler-0.24.1/poppler/GlobalParams.cc 2013-08-17 03:20:42.000000000 +0400 +++ poppler-0.24.1-new/poppler/GlobalParams.cc 2013-08-29 19:18:48.281250000 +0400 @@ -621,6 +621,7 @@ GlobalParams::GlobalParams(const char *c antialias = gTrue; vectorAntialias = gTrue; antialiasPrinting = gFalse; + forceImageInterpolation = gTrue; strokeAdjust = gTrue; screenType = screenUnset; screenSize = -1; @@ -1713,6 +1714,15 @@ GBool GlobalParams::getAntialiasPrinting return f; } +GBool GlobalParams::getForceImageInterpolation() { + GBool f; + + lockGlobalParams; + f = forceImageInterpolation; + unlockGlobalParams; + return f; +} + GBool GlobalParams::getStrokeAdjust() { GBool f; @@ -2107,6 +2117,15 @@ void GlobalParams::setAntialiasPrinting( unlockGlobalParams; } +GBool GlobalParams::setForceImageInterpolation(char* s) { + GBool ok; + + lockGlobalParams; + ok = parseYesNo2(s, &forceImageInterpolation); + unlockGlobalParams; + return ok; +} + void GlobalParams::setStrokeAdjust(GBool adjust) { lockGlobalParams; diff -rup poppler-0.24.1/poppler/GlobalParams.h poppler-0.24.1-new/poppler/GlobalParams.h --- poppler-0.24.1/poppler/GlobalParams.h 2013-08-17 03:20:42.000000000 +0400 +++ poppler-0.24.1-new/poppler/GlobalParams.h 2013-08-29 19:17:32.812500000 +0400 @@ -178,6 +178,7 @@ public: GBool getAntialias(); GBool getVectorAntialias(); GBool getAntialiasPrinting(); + GBool getForceImageInterpolation(); GBool getStrokeAdjust(); ScreenType getScreenType(); int getScreenSize(); @@ -232,6 +233,7 @@ public: GBool setDisableFreeTypeHinting(char *s); GBool setAntialias(char *s); GBool setVectorAntialias(char *s); + GBool setForceImageInterpolation(char* s); void setAntialiasPrinting(GBool print); void setStrokeAdjust(GBool strokeAdjust); void setScreenType(ScreenType st); @@ -335,6 +337,7 @@ private: GBool antialias; // anti-aliasing enable flag GBool vectorAntialias; // vector anti-aliasing enable flag GBool antialiasPrinting; // allow anti-aliasing when printing + GBool forceImageInterpolation; // force image interpolation even if image "interpolate" flag is not set GBool strokeAdjust; // stroke adjustment enable flag ScreenType screenType; // halftone screen type int screenSize; // screen matrix size diff -rup poppler-0.24.1/poppler/SplashOutputDev.cc poppler-0.24.1-new/poppler/SplashOutputDev.cc --- poppler-0.24.1/poppler/SplashOutputDev.cc 2013-08-20 02:54:38.000000000 +0400 +++ poppler-0.24.1-new/poppler/SplashOutputDev.cc 2013-08-29 20:00:46.343750000 +0400 @@ -1214,7 +1214,8 @@ SplashOutputDev::SplashOutputDev(SplashC GBool bitmapTopDownA, GBool allowAntialiasA, SplashThinLineMode thinLineMode, - GBool overprintPreviewA) { + GBool overprintPreviewA, + GBool forceImageInterpolationA) { colorMode = colorModeA; bitmapRowPad = bitmapRowPadA; bitmapTopDown = bitmapTopDownA; @@ -1223,6 +1224,7 @@ SplashOutputDev::SplashOutputDev(SplashC vectorAntialias = allowAntialias && globalParams->getVectorAntialias() && colorMode != splashModeMono1; + forceImageInterpolation = forceImageInterpolationA; overprintPreview = overprintPreviewA; enableFreeTypeHinting = gFalse; enableSlightHinting = gFalse; @@ -1241,7 +1243,7 @@ SplashOutputDev::SplashOutputDev(SplashC bitmap = new SplashBitmap(1, 1, bitmapRowPad, colorMode, colorMode != splashModeMono1, bitmapTopDown); - splash = new Splash(bitmap, vectorAntialias, &screenParams); + splash = new Splash(bitmap, vectorAntialias, &screenParams, forceImageInterpolation); splash->setMinLineWidth(globalParams->getMinLineWidth()); splash->setThinLineMode(thinLineMode); splash->clear(paperColor, 0); @@ -1392,7 +1394,7 @@ void SplashOutputDev::startPage(int page colorMode != splashModeMono1, bitmapTopDown); } } - splash = new Splash(bitmap, vectorAntialias, &screenParams); + splash = new Splash(bitmap, vectorAntialias, &screenParams, forceImageInterpolation); splash->setThinLineMode(thinLineMode); splash->setMinLineWidth(globalParams->getMinLineWidth()); if (state) { @@ -2584,7 +2586,7 @@ void SplashOutputDev::type3D1(GfxState * bitmap = new SplashBitmap(t3Font->glyphW, t3Font->glyphH, 1, splashModeMono1, gFalse); splash = new Splash(bitmap, gFalse, - t3GlyphStack->origSplash->getScreen()); + t3GlyphStack->origSplash->getScreen(), forceImageInterpolation); color[0] = 0; splash->clear(color); color[0] = 0xff; @@ -2592,7 +2594,7 @@ void SplashOutputDev::type3D1(GfxState * bitmap = new SplashBitmap(t3Font->glyphW, t3Font->glyphH, 1, splashModeMono8, gFalse); splash = new Splash(bitmap, vectorAntialias, - t3GlyphStack->origSplash->getScreen()); + t3GlyphStack->origSplash->getScreen(), forceImageInterpolation); color[0] = 0x00; splash->clear(color); color[0] = 0xff; @@ -3841,7 +3843,7 @@ void SplashOutputDev::beginTransparencyG bitmap = new SplashBitmap(w, h, bitmapRowPad, colorMode, gTrue, bitmapTopDown, bitmap->getSeparationList()); splash = new Splash(bitmap, vectorAntialias, - transpGroup->origSplash->getScreen()); + transpGroup->origSplash->getScreen(), forceImageInterpolation); splash->setThinLineMode(transpGroup->origSplash->getThinLineMode()); splash->setMinLineWidth(globalParams->getMinLineWidth()); //~ Acrobat apparently copies at least the fill and stroke colors, and @@ -3944,7 +3946,7 @@ void SplashOutputDev::setSoftMask(GfxSta //~ space is given if (transpGroupStack->blendingColorSpace) { tSplash = new Splash(tBitmap, vectorAntialias, - transpGroupStack->origSplash->getScreen()); + transpGroupStack->origSplash->getScreen(), forceImageInterpolation); switch (tBitmap->getMode()) { case splashModeMono1: // transparency is not supported in mono1 mode diff -rup poppler-0.24.1/poppler/SplashOutputDev.h poppler-0.24.1-new/poppler/SplashOutputDev.h --- poppler-0.24.1/poppler/SplashOutputDev.h 2013-08-17 03:20:42.000000000 +0400 +++ poppler-0.24.1-new/poppler/SplashOutputDev.h 2013-08-29 19:19:18.906250000 +0400 @@ -166,7 +166,8 @@ public: GBool bitmapTopDownA = gTrue, GBool allowAntialiasA = gTrue, SplashThinLineMode thinLineMode = splashThinLineDefault, - GBool overprintPreviewA = globalParams->getOverprintPreview()); + GBool overprintPreviewA = globalParams->getOverprintPreview(), + GBool forceImageInterpolationA = globalParams->getForceImageInterpolation()); // Destructor. virtual ~SplashOutputDev(); @@ -392,6 +393,7 @@ private: GBool bitmapUpsideDown; GBool allowAntialias; GBool vectorAntialias; + GBool forceImageInterpolation; GBool overprintPreview; GBool enableFreeTypeHinting; GBool enableSlightHinting; diff -rup poppler-0.24.1/splash/Splash.cc poppler-0.24.1-new/splash/Splash.cc --- poppler-0.24.1/splash/Splash.cc 2013-08-25 21:30:04.000000000 +0400 +++ poppler-0.24.1-new/splash/Splash.cc 2013-08-29 19:48:10.000000000 +0400 @@ -1415,7 +1415,7 @@ inline void Splash::drawAAPixel(SplashPi // draw the pixel if (t != 0) { pipeSetXY(pipe, x, y); - pipe->shape = div255(aaGamma[t] * pipe->shape); + pipe->shape = div255((int)aaGamma[t] * pipe->shape); (this->*pipe->run)(pipe); updateModX(x); updateModY(y); @@ -1497,7 +1497,7 @@ inline void Splash::drawAALine(SplashPip #endif if (t != 0) { - pipe->shape = (adjustLine) ? div255((int) lineOpacity * (double)aaGamma[t]) : (double)aaGamma[t]; + pipe->shape = (adjustLine) ? div255(int((int)lineOpacity * (double)aaGamma[t])) : Guchar((double)aaGamma[t]); (this->*pipe->run)(pipe); updateModX(x); updateModY(y); @@ -1525,11 +1525,12 @@ inline void Splash::transform(SplashCoor //------------------------------------------------------------------------ Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, - SplashScreenParams *screenParams) { + SplashScreenParams *screenParams, GBool forceImageInterpolationA) { int i; bitmap = bitmapA; vectorAntialias = vectorAntialiasA; + forceImageInterpolation = forceImageInterpolationA; inShading = gFalse; state = new SplashState(bitmap->width, bitmap->height, vectorAntialias, screenParams); @@ -1552,12 +1553,13 @@ Splash::Splash(SplashBitmap *bitmapA, GB } Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, - SplashScreen *screenA) { + SplashScreen *screenA, GBool forceImageInterpolationA) { int i; bitmap = bitmapA; inShading = gFalse; vectorAntialias = vectorAntialiasA; + forceImageInterpolation = forceImageInterpolationA; state = new SplashState(bitmap->width, bitmap->height, vectorAntialias, screenA); if (vectorAntialias) { @@ -2502,7 +2504,7 @@ SplashError Splash::fillWithPattern(Spla transform(state->matrix, 0, 0, &mx, &my); transform(state->matrix, state->lineWidth, 0, &delta, &my); adjustLine = gTrue; - lineShape = clip255((delta - mx) * 255); + lineShape = clip255(int((delta - mx) * 255)); } drawAALine(&pipe, x0, x1, y, adjustLine, lineShape); } @@ -4051,12 +4053,12 @@ SplashError Splash::arbitraryTransformIm // the interpolate flag from the image dictionary static GBool isImageInterpolationRequired(int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, - GBool interpolate) { + GBool interpolate, GBool forceImageInterpolationA) { if (interpolate) return gTrue; - /* When scale factor is >= 400% we don't interpolate. See bugs #25268, #9860 */ - if (scaledWidth / srcWidth >= 4 || scaledHeight / srcHeight >= 4) + /* When asked not to interpolate, or when scale factor is >= 400% we don't interpolate. See bugs #25268, #9860, #68360 */ + if (!forceImageInterpolationA || scaledWidth / srcWidth >= 4 || scaledHeight / srcHeight >= 4) return gFalse; return gTrue; @@ -4084,8 +4086,8 @@ SplashBitmap *Splash::scaleImage(SplashI scaleImageYuXd(src, srcData, srcMode, nComps, srcAlpha, srcWidth, srcHeight, scaledWidth, scaledHeight, dest); } else { - if (!tilingPattern && isImageInterpolationRequired(srcWidth, srcHeight, scaledWidth, scaledHeight, interpolate)) { - scaleImageYuXuBilinear(src, srcData, srcMode, nComps, srcAlpha, + if (!tilingPattern && isImageInterpolationRequired(srcWidth, srcHeight, scaledWidth, scaledHeight, interpolate, forceImageInterpolation)) { + scaleImageYuXuBilinearInt(src, srcData, srcMode, nComps, srcAlpha, srcWidth, srcHeight, scaledWidth, scaledHeight, dest); } else { scaleImageYuXu(src, srcData, srcMode, nComps, srcAlpha, @@ -4937,6 +4939,164 @@ void Splash::scaleImageYuXuBilinear(Spla } gfree(alphaSrcBuf); + gfree(alphaLineBuf1); + gfree(alphaLineBuf2); + gfree(srcBuf); + gfree(lineBuf1); + gfree(lineBuf2); +} + +// expand source row to scaledWidth using linear interpolation +// This is a version of expandRow() that uses integer math instead of floating point math +static void expandRowInt(Guchar *srcBuf, Guchar *dstBuf, int srcWidth, int scaledWidth, int nComps) +{ + if (scaledWidth < srcWidth) return; + if (scaledWidth == srcWidth) { memcpy(dstBuf, srcBuf, scaledWidth * nComps); } + + int x, xSrc, xFrac, xFracInverse, xInt, c; + int srcSpan = srcWidth - 1; + int scaledSpan = scaledWidth - 1; + int srcZ, scaledZ, scaledZNext; + int scaledSpanHalf = scaledSpan/2; // Needed for a slightly more accurate center-point rounding + + // pad the source with an extra pixel equal to the last pixel + // so that when xStep is inside the last pixel we still have two + // pixels to interpolate between. + for (int i = 0; i < nComps; ++i) + srcBuf[srcWidth*nComps + i] = srcBuf[(srcWidth-1)*nComps + i]; + + for (x = 0, xSrc = 0; x < scaledWidth; ++x, xSrc += srcSpan) { + xInt = xSrc / scaledSpan; + xFrac = xSrc % scaledSpan; + xFracInverse = scaledSpan - xFrac; + + for (c = 0, srcZ = nComps * x, scaledZ = nComps * xInt, scaledZNext = nComps * (xInt + 1); + c < nComps; + ++c, ++srcZ, ++scaledZ, ++scaledZNext) + dstBuf[srcZ] = (srcBuf[scaledZ] * xFracInverse + srcBuf[scaledZNext] * xFrac + scaledSpanHalf)/scaledSpan; // Center-point rounding + } +} + +// Scale up image using bilinear interpolation +// This is a version of scaleImageYuXuBilinear() that uses integer math instead of floating point math +void Splash::scaleImageYuXuBilinearInt(SplashImageSource src, void *srcData, + SplashColorMode srcMode, int nComps, + GBool srcAlpha, int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest) { + Guchar *srcBuf, *lineBuf1, *lineBuf2, *alphaSrcBuf, *alphaLineBuf1, *alphaLineBuf2; + Guint pix[splashMaxColorComps]; + Guchar *destPtr0, *destPtr, *destAlphaPtr0, *destAlphaPtr; + + // allocate buffers + srcBuf = (Guchar *)gmallocn(srcWidth+1, nComps); // + 1 pixel of padding + lineBuf1 = (Guchar *)gmallocn(scaledWidth, nComps); + lineBuf2 = (Guchar *)gmallocn(scaledWidth, nComps); + if (srcAlpha) { + alphaSrcBuf = (Guchar *)gmalloc(srcWidth+1); // + 1 pixel of padding + alphaLineBuf1 = (Guchar *)gmalloc(scaledWidth); + alphaLineBuf2 = (Guchar *)gmalloc(scaledWidth); + } else { + alphaSrcBuf = NULL; + alphaLineBuf1 = NULL; + alphaLineBuf2 = NULL; + } + + // Begin + + int currentSrcRow = -1; + + int y, ySrc, yFrac, yFracInverse, yInt, c; + int srcSpan = srcHeight - 1; + int scaledSpan = scaledHeight - 1; + int scaledSpanHalf = scaledSpan/2; // Needed for a slightly more accurate center-point rounding + int z; + + (*src)(srcData, srcBuf, alphaSrcBuf); + + expandRowInt(srcBuf, lineBuf2, srcWidth, scaledWidth, nComps); + if (srcAlpha) + expandRowInt(alphaSrcBuf, alphaLineBuf2, srcWidth, scaledWidth, 1); + + destPtr0 = dest->data; + destAlphaPtr0 = dest->alpha; + + for (y = 0, ySrc = 0; y < scaledHeight; ++y, ySrc += srcSpan) { + yInt = ySrc / scaledSpan; + yFrac = ySrc % scaledSpan; + yFracInverse = scaledSpan - yFrac; + + if (yInt > currentSrcRow) { + currentSrcRow++; + // Copy line2 data to line1 and get next line2 data. + // If line2 already contains the last source row we don't touch it. + // This effectively adds an extra row of padding for interpolating the + // last source row with. + memcpy(lineBuf1, lineBuf2, scaledWidth * nComps); + if (srcAlpha) + memcpy(alphaLineBuf1, alphaLineBuf2, scaledWidth); + if (currentSrcRow < srcHeight) { + (*src)(srcData, srcBuf, alphaSrcBuf); + expandRowInt(srcBuf, lineBuf2, srcWidth, scaledWidth, nComps); + if (srcAlpha) + expandRowInt(alphaSrcBuf, alphaLineBuf2, srcWidth, scaledWidth, 1); + } + } + + // write row y using linear interpolation on lineBuf1 and lineBuf2 + for (int x = 0; x < scaledWidth; ++x) { + // compute the final pixel + for (c = 0, z = x*nComps; c < nComps; ++c, ++z) { + pix[c] = (lineBuf1[z]*yFracInverse + lineBuf2[z]*yFrac + scaledSpanHalf)/scaledSpan; // Center-point rounding + } + + // store the pixel + destPtr = destPtr0 + (y * scaledWidth + x) * nComps; + switch (srcMode) { + case splashModeMono1: // mono1 is not allowed + break; + case splashModeMono8: + *destPtr++ = (Guchar)pix[0]; + break; + case splashModeRGB8: + *destPtr++ = (Guchar)pix[0]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[2]; + break; + case splashModeXBGR8: + *destPtr++ = (Guchar)pix[2]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[0]; + *destPtr++ = (Guchar)255; + break; + case splashModeBGR8: + *destPtr++ = (Guchar)pix[2]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[0]; + break; +#if SPLASH_CMYK + case splashModeCMYK8: + *destPtr++ = (Guchar)pix[0]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[2]; + *destPtr++ = (Guchar)pix[3]; + break; + case splashModeDeviceN8: + for (int cp = 0; cp < SPOT_NCOMPS+4; cp++) + *destPtr++ = (Guchar)pix[cp]; + break; +#endif + } + + // process alpha + if (srcAlpha) { + destAlphaPtr = destAlphaPtr0 + y*scaledWidth + x; + *destAlphaPtr = (alphaLineBuf1[x]*yFracInverse + alphaLineBuf2[x]*yFrac + scaledSpanHalf)/scaledSpan; + } + } + } + + gfree(alphaSrcBuf); gfree(alphaLineBuf1); gfree(alphaLineBuf2); gfree(srcBuf); diff -rup poppler-0.24.1/splash/Splash.h poppler-0.24.1-new/splash/Splash.h --- poppler-0.24.1/splash/Splash.h 2013-08-17 03:20:42.000000000 +0400 +++ poppler-0.24.1-new/splash/Splash.h 2013-08-29 20:02:53.687500000 +0400 @@ -89,9 +89,9 @@ public: // Create a new rasterizer object. Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, - SplashScreenParams *screenParams = NULL); + SplashScreenParams *screenParams = NULL, GBool forceImageInterpolationA = gTrue); Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, - SplashScreen *screenA); + SplashScreen *screenA, GBool forceImageInterpolationA = gTrue); ~Splash(); @@ -391,6 +391,14 @@ private: GBool srcAlpha, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest); + + // This is a version of scaleImageYuXuBilinear() that uses integer math instead of floating point math + void scaleImageYuXuBilinearInt(SplashImageSource src, void *srcData, + SplashColorMode srcMode, int nComps, + GBool srcAlpha, int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest); + void vertFlipImage(SplashBitmap *img, int width, int height, int nComps); void blitImage(SplashBitmap *src, GBool srcAlpha, int xDest, int yDest, @@ -419,6 +427,7 @@ private: int modXMin, modYMin, modXMax, modYMax; SplashClipResult opClipRes; GBool vectorAntialias; + GBool forceImageInterpolation; GBool inShading; GBool debugMode; }; diff -rup poppler-0.24.1/utils/pdftoppm.1 poppler-0.24.1-new/utils/pdftoppm.1 --- poppler-0.24.1/utils/pdftoppm.1 2013-08-17 03:21:40.000000000 +0400 +++ poppler-0.24.1-new/utils/pdftoppm.1 2013-08-29 20:13:20.562500000 +0400 @@ -1,158 +1,161 @@ -.\" Copyright 2005-2011 Glyph & Cog, LLC -.TH pdftoppm 1 "15 August 2011" -.SH NAME -pdftoppm \- Portable Document Format (PDF) to Portable Pixmap (PPM) -converter (version 3.03) -.SH SYNOPSIS -.B pdftoppm -[options] -.I PDF-file PPM-root -.SH DESCRIPTION -.B Pdftoppm -converts Portable Document Format (PDF) files to color image files in -Portable Pixmap (PPM) format, grayscale image files in Portable -Graymap (PGM) format, or monochrome image files in Portable Bitmap -(PBM) format. -.PP -Pdftoppm reads the PDF file, -.IR PDF-file , -and writes one PPM file for each page, -.IR PPM-root - number .ppm, -where -.I number -is the page number. -.SH OPTIONS -.TP -.BI \-f " number" -Specifies the first page to convert. -.TP -.BI \-l " number" -Specifies the last page to convert. -.TP -.B \-o -Generates only the odd numbered pages. -.TP -.B \-e -Generates only the even numbered pages. -.TP -.BI \-singlefile -Writes only the first page and does not add digits. -.TP -.BI \-r " number" -Specifies the X and Y resolution, in DPI. The default is 150 DPI. -.TP -.BI \-rx " number" -Specifies the X resolution, in DPI. The default is 150 DPI. -.TP -.BI \-ry " number" -Specifies the Y resolution, in DPI. The default is 150 DPI. -.TP -.BI \-scale-to " number" -Scales the long side of each page (width for landscape pages, height -for portrait pages) to fit in scale-to pixels. The size of the short -side will be determined by the aspect ratio of the page. -.TP -.BI \-scale-to-x " number" -Scales each page horizontally to fit in scale-to-x pixels. If -scale-to-y is set to -1, the vertical size will determined by the -aspect ratio of the page. -.TP -.BI \-scale-to-y " number" -Scales each page vertically to fit in scale-to-y pixels. If scale-to-x -is set to -1, the horizontal size will determined by the aspect ratio -of the page. -.TP -.BI \-x " number" -Specifies the x-coordinate of the crop area top left corner -.TP -.BI \-y " number" -Specifies the y-coordinate of the crop area top left corner -.TP -.BI \-W " number" -Specifies the width of crop area in pixels (default is 0) -.TP -.BI \-H " number" -Specifies the height of crop area in pixels (default is 0) -.TP -.BI \-sz " number" -Specifies the size of crop square in pixels (sets W and H) -.TP -.B \-cropbox -Uses the crop box rather than media box when generating the files -.TP -.B \-mono -Generate a monochrome PBM file (instead of a color PPM file). -.TP -.B \-gray -Generate a grayscale PGM file (instead of a color PPM file). -.TP -.B \-png -Generates a PNG file instead a PPM file. -.TP -.B \-jpeg -Generates a JPEG file instead a PPM file. -.TP -.B \-tiff -Generates a TIFF file instead a PPM file. -.TP -.BI \-tiffcompression " none | packbits | jpeg | lzw | deflate" -Specifies the TIFF compression type. This defaults to "none". -.TP -.BI \-freetype " yes | no" -Enable or disable FreeType (a TrueType / Type 1 font rasterizer). -This defaults to "yes". -.TP -.BI \-aa " yes | no" -Enable or disable font anti-aliasing. This defaults to "yes". -.TP -.BI \-aaVector " yes | no" -Enable or disable vector anti-aliasing. This defaults to "yes". -.TP -.BI \-opw " password" -Specify the owner password for the PDF file. Providing this will -bypass all security restrictions. -.TP -.BI \-upw " password" -Specify the user password for the PDF file. -.TP -.B \-q -Don't print any messages or errors. -.TP -.B \-v -Print copyright and version information. -.TP -.B \-h -Print usage information. -.RB ( \-help -and -.B \-\-help -are equivalent.) -.SH EXIT CODES -The Xpdf tools use the following exit codes: -.TP -0 -No error. -.TP -1 -Error opening a PDF file. -.TP -2 -Error opening an output file. -.TP -3 -Error related to PDF permissions. -.TP -99 -Other error. -.SH AUTHOR -The pdftoppm software and documentation are copyright 1996-2011 Glyph -& Cog, LLC. -.SH "SEE ALSO" -.BR pdfdetach (1), -.BR pdffonts (1), -.BR pdfimages (1), -.BR pdfinfo (1), -.BR pdftocairo (1), -.BR pdftohtml (1), -.BR pdftops (1), -.BR pdftotext (1) +.\" Copyright 2005-2011 Glyph & Cog, LLC +.TH pdftoppm 1 "15 August 2011" +.SH NAME +pdftoppm \- Portable Document Format (PDF) to Portable Pixmap (PPM) +converter (version 3.03) +.SH SYNOPSIS +.B pdftoppm +[options] +.I PDF-file PPM-root +.SH DESCRIPTION +.B Pdftoppm +converts Portable Document Format (PDF) files to color image files in +Portable Pixmap (PPM) format, grayscale image files in Portable +Graymap (PGM) format, or monochrome image files in Portable Bitmap +(PBM) format. +.PP +Pdftoppm reads the PDF file, +.IR PDF-file , +and writes one PPM file for each page, +.IR PPM-root - number .ppm, +where +.I number +is the page number. +.SH OPTIONS +.TP +.BI \-f " number" +Specifies the first page to convert. +.TP +.BI \-l " number" +Specifies the last page to convert. +.TP +.B \-o +Generates only the odd numbered pages. +.TP +.B \-e +Generates only the even numbered pages. +.TP +.BI \-singlefile +Writes only the first page and does not add digits. +.TP +.BI \-r " number" +Specifies the X and Y resolution, in DPI. The default is 150 DPI. +.TP +.BI \-rx " number" +Specifies the X resolution, in DPI. The default is 150 DPI. +.TP +.BI \-ry " number" +Specifies the Y resolution, in DPI. The default is 150 DPI. +.TP +.BI \-scale-to " number" +Scales the long side of each page (width for landscape pages, height +for portrait pages) to fit in scale-to pixels. The size of the short +side will be determined by the aspect ratio of the page. +.TP +.BI \-scale-to-x " number" +Scales each page horizontally to fit in scale-to-x pixels. If +scale-to-y is set to -1, the vertical size will determined by the +aspect ratio of the page. +.TP +.BI \-scale-to-y " number" +Scales each page vertically to fit in scale-to-y pixels. If scale-to-x +is set to -1, the horizontal size will determined by the aspect ratio +of the page. +.TP +.BI \-x " number" +Specifies the x-coordinate of the crop area top left corner +.TP +.BI \-y " number" +Specifies the y-coordinate of the crop area top left corner +.TP +.BI \-W " number" +Specifies the width of crop area in pixels (default is 0) +.TP +.BI \-H " number" +Specifies the height of crop area in pixels (default is 0) +.TP +.BI \-sz " number" +Specifies the size of crop square in pixels (sets W and H) +.TP +.B \-cropbox +Uses the crop box rather than media box when generating the files +.TP +.B \-mono +Generate a monochrome PBM file (instead of a color PPM file). +.TP +.B \-gray +Generate a grayscale PGM file (instead of a color PPM file). +.TP +.B \-png +Generates a PNG file instead a PPM file. +.TP +.B \-jpeg +Generates a JPEG file instead a PPM file. +.TP +.B \-tiff +Generates a TIFF file instead a PPM file. +.TP +.BI \-tiffcompression " none | packbits | jpeg | lzw | deflate" +Specifies the TIFF compression type. This defaults to "none". +.TP +.BI \-freetype " yes | no" +Enable or disable FreeType (a TrueType / Type 1 font rasterizer). +This defaults to "yes". +.TP +.BI \-aa " yes | no" +Enable or disable font anti-aliasing. This defaults to "yes". +.TP +.BI \-aaVector " yes | no" +Enable or disable vector anti-aliasing. This defaults to "yes". +.TP +.BI \-fii " yes | no" +Enable or disable forced image interpolation. This defaults to "yes". +.TP +.BI \-opw " password" +Specify the owner password for the PDF file. Providing this will +bypass all security restrictions. +.TP +.BI \-upw " password" +Specify the user password for the PDF file. +.TP +.B \-q +Don't print any messages or errors. +.TP +.B \-v +Print copyright and version information. +.TP +.B \-h +Print usage information. +.RB ( \-help +and +.B \-\-help +are equivalent.) +.SH EXIT CODES +The Xpdf tools use the following exit codes: +.TP +0 +No error. +.TP +1 +Error opening a PDF file. +.TP +2 +Error opening an output file. +.TP +3 +Error related to PDF permissions. +.TP +99 +Other error. +.SH AUTHOR +The pdftoppm software and documentation are copyright 1996-2011 Glyph +& Cog, LLC. +.SH "SEE ALSO" +.BR pdfdetach (1), +.BR pdffonts (1), +.BR pdfimages (1), +.BR pdfinfo (1), +.BR pdftocairo (1), +.BR pdftohtml (1), +.BR pdftops (1), +.BR pdftotext (1) diff -rup poppler-0.24.1/utils/pdftoppm.cc poppler-0.24.1-new/utils/pdftoppm.cc --- poppler-0.24.1/utils/pdftoppm.cc 2013-08-20 02:35:40.000000000 +0400 +++ poppler-0.24.1-new/utils/pdftoppm.cc 2013-08-29 19:53:38.109375000 +0400 @@ -91,6 +91,7 @@ static GBool overprint = gFalse; static char enableFreeTypeStr[16] = ""; static char antialiasStr[16] = ""; static char vectorAntialiasStr[16] = ""; +static char forceImageInterpolationStr[16] = ""; static char ownerPassword[33] = ""; static char userPassword[33] = ""; static char TiffCompressionStr[16] = ""; @@ -174,6 +175,8 @@ static const ArgDesc argDesc[] = { "enable font anti-aliasing: yes, no"}, {"-aaVector", argString, vectorAntialiasStr, sizeof(vectorAntialiasStr), "enable vector anti-aliasing: yes, no"}, + {"-fii", argString, forceImageInterpolationStr, sizeof(forceImageInterpolationStr), + "force image interpolation for all images: yes, no"}, {"-opw", argString, ownerPassword, sizeof(ownerPassword), "owner password (for encrypted files)"}, @@ -368,6 +371,12 @@ int main(int argc, char *argv[]) { fprintf(stderr, "Bad '-aaVector' value on command line\n"); } } + if (forceImageInterpolationStr[0]) { + if (!globalParams->setForceImageInterpolation(forceImageInterpolationStr)) { + fprintf(stderr, "Bad '-fii' value on command line\n"); + } + } + if (quiet) { globalParams->setErrQuiet(quiet); }