创建PDF / A与GhostscriptProcessor [英] Creating PDF/A with GhostscriptProcessor

查看:316
本文介绍了创建PDF / A与GhostscriptProcessor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一个PDF文件转换成与GhostscriptProcessor ​​PDF / A,但结果是PDF不是PDF / A。

I want to convert a PDF file into PDF/A with GhostscriptProcessor, but the result is a PDF not 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.Add("-sDEVICE=pdfwrite");
 gsArgs.Add(@"-sOutputFile=" + outputPath);gsArgs.Add(@"-f" + inputPath);
 return gsArgs.ToArray();
 }

如果我用gswin32.exe从命令行结果是PDF / A文件。

If I use gswin32.exe from the commandline the result is a PDF/A file.

推荐答案

首先开关被忽略。您需要在位置0添加虚拟交换机,使代码看起来像:

First switch is ignored. You need to add dummy switch at position 0 so the code will look like:

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

这篇关于创建PDF / A与GhostscriptProcessor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆