A user uploaded a pdf and it converts & resizes, but cuts it in half!
Has anyone else heard of this?
Here is my code:
Code: Select all
//restrict image size to 200 pixels
string newSize = "200x200 ";
string opt = " -resize " + newSize;
// setup a process to run the ImageMagick converter
pdfToPngProcess.StartInfo.UseShellExecute = false;
pdfToPngProcess.StartInfo.CreateNoWindow = true;
pdfToPngProcess.StartInfo.RedirectStandardError = true;
pdfToPngProcess.StartInfo.RedirectStandardOutput = true;
pdfToPngProcess.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + @"\Scripts\ImageMagick\convert.exe";
// quote filenames so we don't have to worry about spaces in file paths
pdfToPngProcess.StartInfo.Arguments = string.Format(@"""{0}"" {1} ""{2}""", sourcePDFPath, opt, destinationFullPath);
//// attempt to convert the images and wait until it completes
pdfToPngProcess.Start();
pdfToPngProcess.WaitForExit();