My PROJECT gives error..
*Unable to find an entry point named 'gsapi_new_instance' in DLL 'gsdll32.dll'.*
when trying to convert .pdf to image format using Ghost-script Interpreter dll 'gsdll32.dll'
Even if I tried copying this dll to all desired places as told in many forums like in
Win\System32 or in The project's directory..The error remains the same..:(
I have used The PDFConvert.cs class given by Ghost-script and written the following code on my Convert Button click:
private void btnConvert_Click(object sender, RoutedEventArgs e)
{
//First We Check whether the Dll is present
if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\gsdll32.dll"))
{
MessageBox.Show("The library 'gsdll32.dll' required to run this program is not present! download GhostScript and copy \"gsdll32.dll\" to this program directory");
return;
}
if (string.IsNullOrEmpty(txtSingleFile.Text))
{
MessageBox.Show("Enter the File name");
txtSingleFile.Focus();
return;
}
else if (!File.Exists(txtSingleFile.Text))
{
MessageBox.Show("The File Does not exists");
txtSingleFile.Focus();
}
else
ConvertPdfToImage(txtSingleFile.Text);
}
and My ConvertPdfToImage Method is as like:
//The Ghost-Script Class Object Creation:
PdfToImage.PDFConvert converter = new PdfToImage.PDFConvert();
public void ConvertPdfToImage(string filename)
{
//bool converted = false;
System.IO.FileInfo input = new FileInfo(filename);
string outPut = string.Format("{0}\\{1}{2}", input.DirectoryName, input.Name, txtExtensionName.Text);
converter.OutputFormat = txtExtensionName.Text;
outPut = outPut.Replace(txtExtensionName.Text, string.Format("{1}{0}", txtExtensionName.Text, DateTime.Now.Ticks));
converter.Convert(input.FullName, outPut);
lblConvertingResult.Content = string.Format("{0}:File Converted..!!", DateTime.Now.ToShortTimeString());
}
i believe This error comes because of the Misplacement of gsdll32.dll library because the same code runs well with the sample demo Provided By the Ghost-Script Interpreter API.. Please Suggest The exact Location where I shuld Keep the dll-gsdll32.dll.!!