private string ProcessPage(PDFFile pdf, string destDir, string guid, int pageIndex, int pageCount, int imgQuality) { string imgPaths = destDir + guid;//Guid.NewGuid().ToString(); if (!Directory.Exists(imgPaths)) { Directory.CreateDirectory(imgPaths); } if (imgQuality == 0) { imgQuality = 100; } Bitmap oriBmp = pdf.GetPageImage(pageIndex, 96); Bitmap bmp = ImageUtility.CutAsBmp(oriBmp, CutBorderWidth, CutTopHeight, oriBmp.Width - 2 * CutBorderWidth, oriBmp.Height - CutTopHeight - CutBottomHeight); string result = string.Format(@"{0}\{1}.jpg", imgPaths, pageIndex); if (bmp.Width >= 700) { _imageHeight = (int)bmp.Height; // / 2; _imageWidth = (int)bmp.Width; // / 2; ImageUtility.ThumbAsJPG(bmp, result, _imageWidth, _imageHeight, imgQuality); //tempImg = bmp.GetThumbnailImage((int)bmp.Width / 2, (int)bmp.Height / 2, new Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero); //tempImg.Save(string.Format(@"{0}\{1}-ori.jpg", imgPaths, i), System.Drawing.Imaging.ImageFormat.Jpeg); } else { _imageHeight = bmp.Height; _imageWidth = bmp.Width; ImageUtility.CompressAsJPG(bmp, result, imgQuality); } return(result); //bmp.Save(string.Format(@"{0}\{1}.jpg",imgPaths,i), System.Drawing.Imaging.ImageFormat.Jpeg); }