In the online 2.0.1.0 cracked version, there will be inexplicable errors, most of the PDF into the picture is OK, but some of the turn out is blank, because I have to involve a lot of PDF to the picture, do not allow errors.
Later, it was discovered that there was a bug in this version. So only upgrade to a higher version. I'm using 4.0.2.0 now.
This version will have a watermark, converted to IL, modified, DLL can not be used, DLL signed, so there is no way.
Only in the picture to be processed, bitmap processing on the line, because the watermark is fixed place, so with GDI re-drawing, remove the part of the watermark can be
1 /// <summary>2 ///how to convert a PDF document to a picture3 /// </summary>4 /// <param name= "Pdfinputpath" >PDF file Path</param>5 /// <param name= "Imageoutputpath" >Picture output full path (including file name)</param>6 /// <param name= "Startpagenum" >start conversion from the first page of a PDF document</param>7 /// <param name= "Endpagenum" >stop Conversion from the first few pages of a PDF document</param>8 /// <param name= "ImageFormat" >set the desired picture format</param>9 /// <param name= "Definition" >set the sharpness of the picture, the larger the number the clearer</param>Ten Private Static voidConvertpdf2image (stringPdfinputpath,stringImageoutputpath, One intStartpagenum,intEndpagenum, ImageFormat ImageFormat,intdefinition) A { - -Pdffile Pdffile =Pdffile.open (pdfinputpath); the - if(Startpagenum <=0) - { -Startpagenum =1; + } - + if(Endpagenum >pdffile.pagecount) A { atEndpagenum =Pdffile.pagecount; - } - - if(Startpagenum >endpagenum) - { - intTemppagenum =Startpagenum; inStartpagenum =Endpagenum; -Endpagenum =Startpagenum; to } + - varBitMap =NewBitmap[endpagenum]; the * for(inti = Startpagenum; I <= endpagenum; i++) $ {Panax NotoginsengBitmap pageimage = Pdffile.getpageimage (i-1, About*definition);
-Bitmap Newpageimage =NewBitmap (pageimage.width/4, pageimage.height/4); the +Graphics g =graphics.fromimage (newpageimage); AG.interpolationmode =interpolationmode.highqualitybicubic;
When you re-draw the y-axis minus 130 and the height minus 130, the watermark won't be visible. theG.drawimage (Pageimage,NewRectangle (0,0, pageimage.width/4, pageimage.height/4), + NewRectangle (0, the, Pageimage.width, pageimage.height- the), graphicsunit.pixel); - $Bitmap[i-1] =Newpageimage; $G.dispose (); - } - the //Merging Pictures - varMergerimg =mergerimg (BITMAP);Wuyi //Save Picture the Mergerimg.save (Imageoutputpath, imageformat); - pdffile.dispose (); Wu } - About /// <summary> $ ///Merging Pictures - /// </summary> - /// <param name= "Maps" ></param> - /// <returns></returns> A Private StaticBitmap mergerimg (paramsbitmap[] maps) + { the inti =maps. Length; - $ if(i = =0) the Throw NewException ("the number of pictures can not be 0"); the Else if(i = =1) the returnmaps[0]; the - //Create a Picture object to display, set the width according to the number of parameters inBitmap backgroudimg =NewBitmap (maps[0]. Width, I * maps[0]. Height); theGraphics g =graphics.fromimage (backgroudimg); the //clear Canvas, background set to white About g.clear (System.Drawing.Color.White); the for(intj =0; J < I; J + +) the { theG.drawimage (Maps[j],0, J *Maps[j]. Height, Maps[j]. Width, Maps[j]. Height); + } - g.dispose (); the returnbackgroudimg;Bayi}
O2S.Components.PDFRender4NET.dll Picture blank bug problem