Skip to content

Module could not be loaded #111

Description

@litao198610

when i use ghostscript.net to print pdf file,the system throw exception "Module could not be loaded",I downloaded gsdll to a local folder,Do you know what caused it? the code is following:
public static void Printpdf(string pdfFilePath,string printerName)
{
try
{
var path = "";
if (Environment.Is64BitOperatingSystem)
{
path = Path.Combine(AppContext.BaseDirectory, "GSDll/gsdll64.dll");
}
else
{
path = Path.Combine(AppContext.BaseDirectory, "GSDll/gsdll32.dll");
}
var gvi = new GhostscriptVersionInfo(path);
Ghostscript.NET.Processor.GhostscriptProcessor processor = new Ghostscript.NET.Processor.GhostscriptProcessor(gvi, true);
var switches = new List();
switches.Add("-empty");
switches.Add("-dPrinted");
switches.Add("-dBATCH");
switches.Add("-dNOPAUSE");
switches.Add("-dNOSAFER");
switches.Add("-dNoCancel");
switches.Add("-dNOPROMPT");
switches.Add("-dNOPAGEPROMPT");
switches.Add("-dPDFFitPage");
switches.Add("-dQueryUser=3");
switches.Add("-dNumCopies=1");
switches.Add("-dSubsetFonts=false");
switches.Add("-sDEVICE=mswinpr2");
switches.Add("-f");
switches.Add(Convert.ToString("-sOutputFile=%printer%") + printerName);
switches.Add(pdfFilePath);
processor.StartProcessing(switches.ToArray(), null);
}
catch (Exception ex)
{
if (System.IO.File.Exists(pdfFilePath)) { System.IO.File.Delete(pdfFilePath); }
throw new Exception(ex.Message,ex);
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions