簡體   English   中英

格式相關-Ghostscript

[英]Format related - Ghostscript

我們使用一個Winform應用程序,該應用程序使用AdobeReader從特定目錄中打印文件。 最近,我們重構了此應用程序,從而用Ghost腳本替換了AdobeReader。 AdobeReader可以正確打印文檔(根據文檔格式,例如字體,對齊方式,行距等)。 但是Ghost腳本會在不符合文檔格式的情況下打印文檔。 有什么建議嗎?

僅供參考: PrintParamter是一種自定義類型,其中包含要打印的文件名/路徑的詳細信息, GetDefaultPrinter()是一種幫助程序方法,它返回默認打印機。

private void PrintDocument(PrintParamter fs, string printerName = null, bool isPortrait = true,
                                   int noOfCopies = 1, bool printInGrey = false)
        {
            var filename = fs.FullyQualifiedName ?? string.Empty;
            printerName = printerName ?? GetDefaultPrinter();
            var processArgs = string.Format("-noquery {0}  -dNumCopies={1} -all {4} -printer \"{2}\" \"{3}\"",
                                            isPortrait ? "-portrait" : "-landscape", noOfCopies != 1 ? noOfCopies : 1,
                                            printerName, filename, printInGrey ? "-grey" : "-colour");
            try
            {

                var gsProcessInfo = new ProcessStartInfo
                                        {
                                            WindowStyle = ProcessWindowStyle.Hidden,
                                            FileName = _ghostScriptLocation,
                                            Arguments = processArgs
                                        };
                using (var gsProcess = Process.Start(gsProcessInfo))
                {
                   gsProcess.WaitForExit();

                }
            }

為了更新,我們放棄了Ghostscript方法,並打算使用iTextSharp來獲取文檔實例並打印它。 從技術上講,iTextSharp不會處理文檔,而是在打印之前將其包裝。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM