GString *ownerPW, *userPW;
SplashColor paperColor;
SplashOutputDev *splashOut;
- SplashBitmap*bitmap = 0;
GBool ok;
int exitCode;
int pg;
- double r;
exitCode = 99;
splashOut->startDoc(doc->getXRef());
- r = resolution;
- if(width) {
- int old_width = doc->getPageCropWidth(page);
- r = 72.0*width/old_width;
- }
-
- doc->displayPage(splashOut, page, r, r, 0, gFalse, gTrue, gFalse);
- bitmap = splashOut->getBitmap();
- if(bitmap) {
- Guchar*rgb = bitmap->getDataPtr();
- int width = bitmap->getWidth();
- int height = bitmap->getHeight();
- jpeg_save(rgb, width, height, quality, output);
+ if(page>=1 && page<=doc->getNumPages()) {
+ double r = resolution;
+ if(width) {
+ int old_width = doc->getPageCropWidth(page);
+ r = 72.0*width/old_width;
+ }
+ doc->displayPage(splashOut, page, r, r, 0, gFalse, gTrue, gFalse);
+ SplashBitmap*bitmap = splashOut->getBitmap();
+ if(bitmap) {
+ Guchar*rgb = bitmap->getDataPtr();
+ int width = bitmap->getWidth();
+ int height = bitmap->getHeight();
+ jpeg_save(rgb, width, height, quality, output);
+ }
}
delete splashOut;
-
exitCode = 0;
os2->yStrikeoutSize = ttf->head->units_per_em / 10;
os2->yStrikeoutPosition = ymid;
os2->usWinAscent = ttf->ascent;
- os2->usWinDescent = -ttf->descent;
+ os2->usWinDescent = ttf->descent>0?0:-ttf->descent;
os2->sxHeight = ymid;
os2->sCapHeight = height*2/3;
}