Using C#, I need to convert each page of a PDF file into separate images and display the images.
Is it possible to do this without using a 3rd party DLL?
You can also use ac# code that is easly downloadable from Code Project that use Ghostscript
http://www.codeproject.com/KB/cs/GhostScriptUseWithCSharp.aspx
Not a huge job, as it has already been done :)
you'll need ghostscript installed (mainly gsdll32.dll), and the c# wrapper from http://redmanscave.blogspot.com/
It's one .cs file. For some reason you'll have to email him for the file, it is not posted.
To convert you'll just a few lines, for example:
string cl2 = @"-dSAFER -dNoVerifyXref -dQUIET -dNOPROMPT"
+ " -dBATCH -dNOPAUSE -sDEVICE=jpeg -r72 -dFirstPage=1 "
+ "-dLastPage=1 -dUseCropBox -sOutputFile=" + SourceFile
+ " " + TargetFile;
try
{
Made4Print.GhostScript gs =
new Made4Print.GhostScript(@"[path-to-gs-installation]");
gs.CallGSDll(cl2.Split(' '));
}
catch
{
//exception handler
}
this saves 1st page as jpeg @ 72 dpi
我过去几次使用O2的PDF4NET并且非常满意http://www.o2sol.com/pdf4net/overview.htm
I have done with this ghost script to convert PDF to Image.hope this one is helpful
"-dNOPAUSE -dBATCH -dSAFER -sDEVICE=tifflzw -dTextAlphaBits=1 -dPDFFitPage -sOutputFile="C:\\Users\\cis\\Desktop\\asp634667352520620000.tif" "C:\\Users\\cis\\Desktop\\asp.pdf""
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.