Ghostscript 获取错误代码:“quot;调用';时出错;gsapi_init_,带参数';制造:-100“;无法从现有代码中找到问题
使用Ghostscript.NET; 使用Ghostscript.NET.Processor 命名空间Metro.MbaProcessing.Core { 内部静态类PdfToText { 私有常量字符串HandleTag=“%handle%”; 私有常量字符串HandleFormat=“X2”Ghostscript 获取错误代码:“quot;调用';时出错;gsapi_init_,带参数';制造:-100“;无法从现有代码中找到问题,ghostscript,pdftotext,Ghostscript,Pdftotext,使用Ghostscript.NET; 使用Ghostscript.NET.Processor 命名空间Metro.MbaProcessing.Core { 内部静态类PdfToText { 私有常量字符串HandleTag=“%handle%”; 私有常量字符串HandleFormat=“X2” }发现这是由我得到的一个错误引起的:CS0116“名称空间不能直接包含字段或方法等成员”。这是由第20行和第21行中使用变量引起的吗? using System.Text; internal
}发现这是由我得到的一个错误引起的:CS0116“名称空间不能直接包含字段或方法等成员”。这是由第20行和第21行中使用变量引起的吗?
using System.Text;
internal static string Process(string filePath, Encoding encoding)
{
GhostscriptVersionInfo gsv = GhostscriptVersionInfo.GetLastInstalledVersion();
using var processor = new GhostscriptProcessor(gsv);
using var pipedOutput = new GhostscriptPipedOutput();
string outputPipeHandle = $"{HandleTag}{int.Parse(pipedOutput.ClientHandle).ToString(HandleFormat)}";
string[] switches =
{
$"-o{outputPipeHandle}",
"-empty",
"-dQUIET",
"-dSAFER",
"-dBATCH",
"-dNOPAUSE",
"-dNOPROMPT",
"-sDEVICE=txtwrite",
//$"-o{outputPipeHandle}",
"-q",
"-f",
filePath
};
processor.StartProcessing(switches, null);
return encoding.GetString(pipedOutput.Data);
}
}