I have a programming task. where I need to use a free library or a command line program to convert pdf to image using C#.
So far converting using Ghostscript works except that it creates a 8 red box in the center of the image:
The content of the pdf is pure white only, but why do i have 8 red box on the image? What did i do wrong?
Here's the code:
string outputImagesPath = null;
string inputPDFFile = null;
inputPDFFile = @"C:\Users\user\cover.pdf";
outputImagesPath = @"C:\user\Desktop\1.jpg";
string ghostScriptPath = @"C:\Users\gswin32.exe";
String ars = "-o" + outputImagesPath+ "%03d.png -sDEVICE=jpeg -dJPEGQ=100 " + inputPDFFile;
Process proc = new Process();
proc.StartInfo.FileName = ghostScriptPath;
proc.StartInfo.Arguments = ars;
proc.StartInfo.CreateNoWindow = true;
//proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start();
string strOutput = proc.StandardOutput.ReadToEnd();
Console.WriteLine(strOutput);
proc.WaitForExit();
here is the link of the pdf, thank you https://drive.google.com/open?id=0B0auNx4EZsCUUkFHWGR4MjV5NzA