小编Tho*_*urn的帖子

Ghostscript转换PDF并输出文本文件

1.我需要将PDF文件转换为txt.file.我的命令似乎工作,因为我在屏幕上获得转换后的文本,但不知何故,我无法将输出定向到文本文件.

public static string[] GetArgs(string inputPath, string outputPath)
{ 
    return new[] {
                "-q", "-dNODISPLAY", "-dSAFER",
                "-dDELAYBIND", "-dWRITESYSTEMDICT", "-dSIMPLE",
                "-c", "save", "-f",
                "ps2ascii.ps", inputPath, "-sDEVICE=txtwrite",
                String.Format("-sOutputFile={0}", outputPath),
                "-c", "quit"
    }; 
}
Run Code Online (Sandbox Code Playgroud)

2.有一个unicode speficic .ps吗?

更新: 发布我的完整代码,可能错误在其他地方.

public static string[] GetArgs(string inputPath, string outputPath)
{
    return new[]    
    {   "-o c:/test.txt",    
        "-dSIMPLE",
        "-sFONTPATH=c:/windows/fonts",
        "-dNODISPLAY",
        "-dDELAYBIND",
        "-dWRITESYSTEMDICT",
        "-f",
        "C:/Program Files/gs/gs9.05/lib/ps2ascii.ps",               
        inputPath,
    };
}

[DllImport("gsdll64.dll", EntryPoint = "gsapi_new_instance")]
private static extern int CreateAPIInstance(out IntPtr pinstance, IntPtr caller_handle);

[DllImport("gsdll64.dll", EntryPoint = "gsapi_init_with_args")]
private static extern int …
Run Code Online (Sandbox Code Playgroud)

c# pdf ghostscript text-files

5
推荐指数
1
解决办法
7435
查看次数

标签 统计

c# ×1

ghostscript ×1

pdf ×1

text-files ×1