Hi Team,
I am getting the following error - "An exception of type 'ImageMagick.MagickDelegateErrorException' occurred in Magick.NET-Q16-AnyCPU.dll but was not handled in user code Additional information: PDFDelegateFailed `The system cannot find the file specified. ' @ error/pdf.c/ReadPDFImage/793"
What I am trying to do:
1)Upload a pdf file hadrly of size 1 MB
2)Loop through each and every page of the PDF file and convert each page to a bitmap image
3)Then input the Bitmap image to the Tesseract for doing OCR
My piece of code:
-------------------
public void SplitFile(string filePath)
{
ImageMagick.MagickReadSettings settings = new ImageMagick.MagickReadSettings();
settings.Density = new ImageMagick.Density(300, 300);
ImageMagick.MagickImageCollection images = new ImageMagick.MagickImageCollection();
images.Read(filePath, settings); // IN THIS lINE I AM GETTING THE ABOVE ERROR
for (int pageNumber = 0; i <= images.Count; i++)
{
bitmap = images[pageNumber].ToBitmap();
BitmapToPixConverter b = new BitmapToPixConverter();
Pix pix = b.Convert(bitmap);
ProcessOCR(pix, pageNumber);
}
}
Looking forward for some inputs on how to get rid of the above mention error.
Installed the following package from Nuget package manger - Imagick.NET-Q16-AnyCPU
Version - 7.0.5.900
.Net framework - 4.5
Thanks in Advance,
Hari
ImageMagick.MagickDelegateErrorException
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: ImageMagick.MagickDelegateErrorException
I suggest you printf the value of filePath. Does that file exist?Harik wrote:The system cannot find the file specified.
I also suggest you try the equivalent from the command line. Does that work?
snibgo's IM pages: im.snibgo.com
Re: ImageMagick.MagickDelegateErrorException
Did you install Ghostscript? You will need this to read PDF files. Be aware that you need a paid license when you want to use it in a commercial application.