使用GhostscriptProcessor创建PDF / A

罗牛

我想使用GhostscriptProcessor将PDF文件转换为PDF / A,但是结果是PDF而不是PDF / A。

GhostscriptProcessor gsproc = new GhostscriptProcessor(Properties.Resources.gsdll32);
gsproc.StartProcessing(CreatePDFA(@"C:\test\PDF.pdf", @"C:\test\PDFA.pdf"), new GsStdio());

和方法:

CreateTestArgs(string inputPath, string outputPath)
{
    List<string> gsArgs = new List<string>();
    gsArgs.Add("-dPDFA");
    gsArgs.Add("-dBATCH");
    gsArgs.Add("-dNOPAUSEgsArgs");
    gsArgs.Add("-sDEVICE=pdfwrite");
    gsArgs.Add(@"-sOutputFile=" + outputPath);
    gsArgs.Add(@"-f" + inputPath);
    return gsArgs.ToArray();
}

如果我从命令行使用gswin32.exe,则结果为PDF / A文件。

哈班

第一开关被忽略。您需要在位置0添加虚拟开关,因此代码如下所示:

string[] CreateTestArgs(string inputPath, string outputPath)
{
    List<string> gsArgs = new List<string>();
    gsArgs.Add("-notused");
    gsArgs.Add("-dPDFA");
    gsArgs.Add("-dBATCH");
    gsArgs.Add("-dNOPAUSEgsArgs");
    gsArgs.Add("-sDEVICE=pdfwrite");
    gsArgs.Add(@"-sOutputFile=" + outputPath);
    gsArgs.Add(@"-f" + inputPath);
    return gsArgs.ToArray();
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章