打印PDF文件以改变默认的打印机设置打印机、文件、PDF

2023-09-06 05:53:01 作者:一杯浊酒笑风尘

谷歌/冰didnt带来的任何解决方案,我以下的问题,希望有人能帮助我:

Google/Bing didnt bring up any solution to my following problem, hope someone can help me:

我们必须在我们的基于C#程序打印各种PDF文件。在我们可以打印,我们要配置的打印机,如设置方向为横向。

We have to print various PDF files in our C# based program. Before we can print, we have to configure the printer, e.g. setting the orientation to landscape.

我试图改变默认的打印机设置,例如,像这样的:

I tried to change the default printer settings e.g. like this:

PrinterSettings settings = new PrinterSettings();
settings.PrinterName = "\\\\SomeNetworkPrinter\\";
settings.DefaultPageSettings.Landscape = true;
settings.Duplex = Duplex.Horizontal;

我们发送PDF通过PDFSharp,基本上工作了打印机,但我的设置完全地忽略。是不是有可能改变默认的打印机设置这种方式?我们是否有任何机会,以更改设置并打印了PDF格式的文件吗?

We send the PDF to the printer via PDFSharp, which basically works, but my settings are completly ignored. Isn't it possible to change the default printer settings this way? Do we have any chance to change the settings and print our PDF-files?

非常感谢你提前!

推荐答案

要回答我的问题...

To answer my own question ...

在试错我不认为有任何机会,以通过配置.NET和打印PDF文件打印后的3天。你不能使用System.Drawing.Printing.PrintDocument类结合PDF文件,但使用的PrintDocument似乎是prerequisit更改打印机设置。

After 3 days of trial and error I dont think there is any chance to configure the printer via .NET and print PDFs afterwards. You cant use the System.Drawing.Printing.PrintDocument class in combination with PDFs, but using PrintDocument seems to be a prerequisit to change the printer settings.

我的解决方案来配置打印机的灵感来自于这个职位上codePLEX:的 HTTP://www.$c$cproject.com/KB/dotnet/NET_Printer_Library.aspx

My solution to configure the printer was inspired by this post on codeplex: http://www.codeproject.com/KB/dotnet/NET_Printer_Library.aspx

要最后打印我通过命令行参数到Adobe Reader发送的PDF格式。

To finally print the pdf I send it via commandline parameters to Adobe Reader.

 
精彩推荐