简体   繁体   English

我收到错误消息:CS0116 namspace 不能直接包含第 3 行的成员,例如字段或方法

[英]I am getting a errors: CS0116 A namspace cannot directly contain members such as fields or methods on Line 3

#nullable enable

using System.Text;

using Ghostscript.NET;
using Ghostscript.NET.Processor;

namespace Metro.MbaProcessing.Core
{
internal static class PdfToText
{
    private const string HandleTag = "%handle%";
    private const string HandleFormat = "X2";


    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);
    }
}
}

You need to load the ghostcript nuget package.您需要加载 ghostcript nuget 包。

Click on tools.点击工具。
Nuget package manager. Nuget 包管理器。
Manage Nuget Packages for solution.管理 Nuget 包以获取解决方案。
Click Browse Tab单击Browse选项卡
Search for GhostScript.NetCore by Stephan Jimane搜索 Stephan Jimane 的 GhostScript.NetCore
Install安装

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误 CS0116:命名空间不能直接包含成员,例如字段或方法 - Error CS0116: A namespace cannot directly contain members such as fields or methods Unity中的“错误CS0116:命名空间不能直接包含字段或方法等成员” - “error CS0116: A namespace cannot directly contain members such as fields or methods” in Unity C# 错误“CS0116:命名空间不能直接包含字段或方法等成员” - C# errror "CS0116: A namespace cannot directly contain members such as fields or methods" unity 3D:错误CS0116:命名空间不能直接包含字段或方法等成员 - Unity 3D: Error CS0116: A namespace cannot directly contain members such as fields or methods CS0116名称空间不能直接包含字段或方法之类的成员 - CS0116 A name Space Cannot Directly Contain Members Such As Fields Or Methods 错误 CS0116:命名空间不能直接包含字段或方法等成员 - 使用记事本手写编码 - error CS0116: A namespace cannot directly contain members such as fields or methods- hand writing coding using notepad CS0116 命名空间不能直接包含字段或方法等成员 C# Microsoft.Office.Interop.Excel - CS0116 A namespace cannot directly contain members such as field or methods C# Microsoft.Office.Interop.Excel 错误CS0116和CS0246 - Errors CS0116 and CS0246 使用.rsp文件进行构建时,为什么会出现错误CS0116? - Why am I getting error CS0116 when building using a .rsp file? 如何解决以下错误?:错误 CS1022 和错误 CS0116 - How can I resolve the following errors?: Error CS1022 and Error CS0116
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM