With a cracked version of the O2S.Components.PDFRender4NET.dll plugin, simple reference can be
Public Static classPdftoimage { Public StaticMemoryStream Getpdfimagepagestream (stringPdfinputpath,intPageIndex, ImageFormat format,intwidth = the,intHeight =2560,intQuality =Ten) { Try { //PDF Processing PluginPdffile Pdffile =Pdffile.open (Pdfinputpath); intTotal =Pdffile.pagecount; #regionPrevent exception parametersif(PageIndex <0) {PageIndex=0; } if(PageIndex >Total ) {PageIndex= Total-1; } if(Quality <1) {Quality=1; } if(Quality >Ten) {Quality=Ten; } if(Width <=0) {width=1; } if(Height <=0) {Height=1; } #endregion //PDF Conversion PicturesSizeF pageSize =pdffile.getpagesize (PageIndex); Bitmap Pageimage= Pdffile.getpageimage (PageIndex, About*quality); MemoryStream Ms=NewMemoryStream (); Pageimage.save (MS, format); //OriginalImage img = Image.fromstream (MS,true); DoubleRatio = (Double) Width/(Double) height; DoubleOratio = (Double) img. Width/(Double) img. Height; intSbwidth =0; intSbheight =0; intOutX =0; intOuty =0; if(Oratio <ratio) {Sbwidth= (int) (IMG. Width * (Double) Height/(Double) (IMG. Height)); Sbheight=height; OutX= (width-sbwidth)/2; } Else{sbheight= (int) (IMG. Height * (Double) Width/(Double) (IMG. Width)); Sbwidth=width; Outy= (height-sbheight)/2; } //ZoomImage sbimg =NewBitmap (Sbwidth, sbheight); Graphics Sbgra=graphics.fromimage (SBIMG); Sbgra.interpolationmode=System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; Sbgra.smoothingmode=System.Drawing.Drawing2D.SmoothingMode.HighQuality; Sbgra.clear (Color.White); Sbgra.drawimage (IMG,NewSystem.Drawing.Rectangle (0,0, Sbwidth, Sbheight),NewSystem.Drawing.Rectangle (0,0, IMG. Width, IMG. Height), System.Drawing.GraphicsUnit.Pixel); //FillerImage outimg =NewSystem.Drawing.Bitmap (width, height); Graphics Outgra=System.Drawing.Graphics.FromImage (OUTIMG); Outgra.interpolationmode=System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; Outgra.smoothingmode=System.Drawing.Drawing2D.SmoothingMode.HighQuality; Outgra.clear (Color.White); Outgra.drawimage (sbimg,NewSystem.Drawing.Rectangle (OutX, Outy, Sbwidth, Sbheight),NewSystem.Drawing.Rectangle (0,0, Sbwidth, sbheight), System.Drawing.GraphicsUnit.Pixel); MemoryStream Outms=NewMemoryStream (); Outimg.save (OUTMS, format); Sbimg.dispose (); Outimg.dispose (); Img. Dispose (); returnOutms; } Catch(Exception ex) {}return NewMemoryStream (); } Public StaticMemoryStream Getpdfimagepagestream (Stream stream,intPageIndex, ImageFormat format,intwidth = the,intHeight =2560,intQuality =Ten) { Try { //PDF Processing PluginPdffile Pdffile =Pdffile.open (stream); intTotal =Pdffile.pagecount; #regionPrevent exception parametersif(PageIndex <0) {PageIndex=0; } if(PageIndex >Total ) {PageIndex= Total-1; } if(Quality <1) {Quality=1; } if(Quality >Ten) {Quality=Ten; } if(Width <=0) {width=1; } if(Height <=0) {Height=1; } #endregion //PDF Conversion PicturesSizeF pageSize =pdffile.getpagesize (PageIndex); Bitmap Pageimage= Pdffile.getpageimage (PageIndex, About*quality); MemoryStream Ms=NewMemoryStream (); Pageimage.save (MS, format); //OriginalImage img = Image.fromstream (MS,true); DoubleRatio = (Double) Width/(Double) height; DoubleOratio = (Double) img. Width/(Double) img. Height; intSbwidth =0; intSbheight =0; intOutX =0; intOuty =0; if(Oratio <ratio) {Sbwidth= (int) (IMG. Width * (Double) Height/(Double) (IMG. Height)); Sbheight=height; OutX= (width-sbwidth)/2; } Else{sbheight= (int) (IMG. Height * (Double) Width/(Double) (IMG. Width)); Sbwidth=width; Outy= (height-sbheight)/2; } //ZoomImage sbimg =NewBitmap (Sbwidth, sbheight); Graphics Sbgra=graphics.fromimage (SBIMG); Sbgra.interpolationmode=System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; Sbgra.smoothingmode=System.Drawing.Drawing2D.SmoothingMode.HighQuality; Sbgra.clear (Color.White); Sbgra.drawimage (IMG,NewSystem.Drawing.Rectangle (0,0, Sbwidth, Sbheight),NewSystem.Drawing.Rectangle (0,0, IMG. Width, IMG. Height), System.Drawing.GraphicsUnit.Pixel); //FillerImage outimg =NewSystem.Drawing.Bitmap (width, height); Graphics Outgra=System.Drawing.Graphics.FromImage (OUTIMG); Outgra.interpolationmode=System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; Outgra.smoothingmode=System.Drawing.Drawing2D.SmoothingMode.HighQuality; Outgra.clear (Color.White); Outgra.drawimage (sbimg,NewSystem.Drawing.Rectangle (OutX, Outy, Sbwidth, Sbheight),NewSystem.Drawing.Rectangle (0,0, Sbwidth, sbheight), System.Drawing.GraphicsUnit.Pixel); MemoryStream Outms=NewMemoryStream (); Outimg.save (OUTMS, format); Sbimg.dispose (); Outimg.dispose (); Img. Dispose (); returnOutms; } Catch(Exception ex) {}return NewMemoryStream (); } }View Code
. NET PDF to Picture