使用GhostscriptProcessor打印PDF文件-边距杂乱 [英] Using GhostscriptProcessor to print a PDF file - Margins are messy

查看:349
本文介绍了使用GhostscriptProcessor打印PDF文件-边距杂乱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图将PDF文件发送到打印机,以便使用C#中的GhostscriptProcessor进行打印.一切进展顺利,文件正在打印,但是正在应用轻微缩放(大约1.1倍-1.05倍),我找不到指定最高边距或更改呈现的PDF的最终大小的方法.

I'be been trying to send a PDF file to my printer to print using GhostscriptProcessor in C#. Everything is going well and the file is being printed but a slight zoom (around 1.1x - 1.05x) is being applied and I can't find a way to specify Top Margins or change the final size of the rendered PDF.

打印机的页面大小似乎与我正在渲染的页面大小不同.有什么办法可以避免这种情况?

It seems like the page size from the printer are different from the ones I'm rendering. Is there any way to circumvent that?

这就是我所拥有的:

string printerName = "MIAUMIAUMIAU";
using (GhostscriptProcessor processor = new GhostscriptProcessor())
{
    List<string> switches = new List<string>();
    switches.Add("-empty");
    switches.Add("-dPrinted");
    switches.Add("-dBATCH");
    switches.Add("-dNOPAUSE");
    switches.Add("-dNOSAFER");
    switches.Add("-dDuplex");
    switches.Add("-dTumble=0");
    switches.Add("-dNumCopies=1");
    switches.Add("-sDEVICE=mswinpr2");                                
    switches.Add("-sOutputFile=%printer%" + printerName);
    switches.Add("-f");
    switches.Add(inputFile);
    processor.StartProcessing(switches.ToArray(), null);
}

推荐答案

打印机的可打印区域和PDF文件的MediaBox之类的声音略有不同.渲染为位图时(mswinpr2的工作方式),Ghostscript将缩放PDF,直到其声明的MediaBox与打印机的声明的介质大小匹配为止.

Sounds like the printable area of your printer and the MediaBox of the PDF file are slightly different. When rendering to a bitmap (which is how mswinpr2 works) Ghostscript will scale the PDF until its declared MediaBox matches the declared media size of the printer.

这篇关于使用GhostscriptProcessor打印PDF文件-边距杂乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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