天道酬勤,学无止境

ghostscript.net

Ghostscript clips a pdf file

问题 我正在尝试使用这些设置使用 Ghostscript 打印 pdf: var switches = new List<string> { @"-empty", @"-dPrinted", @"-dNOPAUSE", @"-dNOSAFER", @"-dQUIET", @"-dPDFSETTINGS=/printer", @"-dNumCopies=1", @"-sDEVICE=mswinpr2", @"-dCompatibilityLevel=1.4", @"-sOutputFile=%printer%" + printerSettings.PrinterName, @"-f", pdfFileName }; 但是 pdf 或 Ghostscript 的边距都很差,虽然当我在打印机上打印时将其打印到文件中时它会很好。 有没有办法用 Ghostscript 以编程方式添加这些? 我从谷歌的第一页尝试了许多不同的解决方案,但它们都不起作用,而且它们似乎对打印的 pdf 没有影响。 当我尝试使用 Adob​​e 或 IE 将其打印出来时,只要我选择了打印机,它就会神奇地添加边距并且打印效果很好。 如何使用 Ghostscript 达到同样的效果? 回答1 好的,第一件事是您设置的许多开关都没有效果: -empty 不是 Ghostscript 可以理解的开关,我有点惊讶它不会导致错误

2022-04-27 08:35:04    分类:技术分享    c#   pdf   ghostscript   ghostscript.net

Can ghostscript.net divide a PDF file to multiple sections?

I have a very long PDF file (58x500 inches). The goal is to divide one large vector pdf file to a certain percentage. For example %25 = 125 inches in height while the width stay the same. So one large pdf will be divided into 4 pages. ImageMagick was able to do this but it crashes if I changed the dpi to 300. Is it possible to do this with Ghostscript? I am currenlty using Ghostscipt.net and C#. Can someone point me to the right direction?

2022-03-24 08:18:28    分类:问答    c#   ghostscript   ghostscript.net

Ghostscript clips a pdf file

I'm trying to print a pdf with Ghostscript using those settings : var switches = new List<string> { @"-empty", @"-dPrinted", @"-dNOPAUSE", @"-dNOSAFER", @"-dQUIET", @"-dPDFSETTINGS=/printer", @"-dNumCopies=1", @"-sDEVICE=mswinpr2", @"-dCompatibilityLevel=1.4", @"-sOutputFile=%printer%" + printerSettings.PrinterName, @"-f", pdfFileName }; but either the pdf or Ghostscript have bad margins and while it's good when I print it to file it clips when I print it on my printer. Is there any way to add those programatically with Ghostscript ? I tried many different solutions from first pages of google

2022-03-22 23:02:04    分类:问答    c#   pdf   ghostscript   ghostscript.net

Ghostscript.NET Multithreading Issue

The longest part of a monthly process we run is the automated slicing and conversion of some PDFs to images. Each PDF is read in, converted to 3 different PDFs, and those 3 are converted to images to be placed in e-mails to customers. The PDFs are unique per-customer, and we send a monthly PDF to at least 15,000 (frequently more like 22k) customers. Our PDF generation and slicing is already multithreaded, but I've been looking into parallelizing the remaining bits of it. To that end, I have converted our process to use Ghostscript.NET, which purports to be a library that supports parallelizing

2022-03-21 00:53:52    分类:问答    c#   ghostscript   pdf-conversion   ghostscript.net

我可以用 GhostscriptProcessor 返回 byte[] 吗?(Can I return byte[] with GhostscriptProcessor?)

问题 是否可以使用 GhostscriptProcessor 返回 byte[]? 例如: public static byte[] ConvertToPDFA(byte[] pdfData) { GhostscriptProcessor gsproc = new GhostscriptProcessor(Properties.Resources.gsdll32); //return byte[] from the created PDF/A StartProcessing 方法是一个 void 方法,但是有没有其他方法可以从 PDF 文件创建 PDF/A 并从其内容中返回一个 byte[]? 回答1 这是可能的: public class PipedOutputSample { public void Start() { string inputFile = @"E:\gss_test\test_postscript.ps"; GhostscriptPipedOutput gsPipedOutput = new GhostscriptPipedOutput(); // pipe handle format: %handle%hexvalue string outputPipeHandle = "%handle%" + int.Parse(gsPipedOutput

2022-01-12 16:40:37    分类:技术分享    c#   pdfa   ghostscript.net

Can I return byte[] with GhostscriptProcessor?

Is it possible to return byte[] using the GhostscriptProcessor? For example: public static byte[] ConvertToPDFA(byte[] pdfData) { GhostscriptProcessor gsproc = new GhostscriptProcessor(Properties.Resources.gsdll32); //return byte[] from the created PDF/A The method StartProcessing is a void method, but is there any alternative thet can create a PDF/A from a PDF File and return a byte[] from its content?

2022-01-12 07:34:24    分类:问答    c#   pdfa   ghostscript.net

使用 GhostscriptProcessor 创建 PDF/A(Creating PDF/A with GhostscriptProcessor)

问题 我想使用 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 文件。 回答1

2021-12-11 07:53:38    分类:技术分享    c#   visual-studio-2010   ghostscript   pdfa   ghostscript.net

GhostscriptRasterizer 对象返回 0 作为 PageCount 值(GhostscriptRasterizer Objects Returns 0 as PageCount value)

问题 txtStatus.Text = ""; if (!File.Exists(txtOpenLocation.Text)) { txtStatus.Text = "File Not Found"; return; } txtStatus.Text = "File Found"; const string DLL_32BITS = "gsdll32.dll"; const string DLL_64BITS = "gsdll64.dll"; //select DLL based on arch string NomeGhostscriptDLL; if (Environment.Is64BitProcess) { NomeGhostscriptDLL = DLL_64BITS; } else { NomeGhostscriptDLL = DLL_32BITS; } GhostscriptVersionInfo gvi = new GhostscriptVersionInfo(NomeGhostscriptDLL); var rasterizer = new GhostscriptRasterizer(); try { rasterizer.Open(txtOpenLocation.Text, gvi, true); Console.WriteLine(rasterizer

2021-12-05 03:14:56    分类:技术分享    c#   ghostscript.net

Creating PDF/A with GhostscriptProcessor

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()); And the method: 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();

2021-11-25 23:21:59    分类:问答    c#   visual-studio-2010   ghostscript   pdfa   ghostscript.net