【问题标题】:print pdf in both sides双面打印pdf
【发布时间】:2023-03-18 08:53:02
【问题描述】:

所以,我正在使用 PDFSharp 库,并且,我想在两面打印 pdf.... 我的打印机是 hp2055dn 我已经尝试过所有的东西......顺便说一句......我的代码是:

using PdfSharp.Pdf.Printing;
using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace impressao
{
    class Program
    {
        static void Main(string[] args)
        {
            PdfFilePrinter.AdobeReaderPath = @"C:\Program Files (x86)\Adobe\Acrobat 8.0\Acrobat\Acrobat.exe";
            //PdfFilePrinter.AdobeReaderPath = @"C:\Program Files (x86)\Foxit Software\Foxit Reader\Foxit Reader.exe";

            PrinterSettings settings = new PrinterSettings();
            settings.Collate = false;
            settings.Duplex = Duplex.Vertical;

            PrintDialog printerDialog = new PrintDialog();
            printerDialog.AllowSomePages = false;
            printerDialog.ShowHelp = false;
            printerDialog.PrinterSettings = settings;
            printerDialog.AllowPrintToFile = true;
            printerDialog.PrinterSettings.PrintToFile = true;
            DialogResult result = printerDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                PdfFilePrinter printer = new PdfFilePrinter("0.pdf", settings.PrinterName);

                try
                {
                    printer.Print();
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error: " + ex.Message);
                }
            }
        }
    }
}

如果有另一种方法,另一个库,或者,另一个设置,或者另一个 dll...请告诉我 是否可以用 C 或 C++ 制作另一个程序,我只是将参数传递给打印...我不知道...

我需要很多,而且很急:(

谢谢 亚历山大

【问题讨论】:

  • 这肯定是打印机设置,而不是您要在代码中控制的东西?

标签: c# pdf printing pdfsharp


【解决方案1】:

我找到了解决方案,我创建了一台新打印机并设置了双面打印的默认设置...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-10
    • 1970-01-01
    • 1970-01-01
    • 2018-05-06
    • 2022-01-24
    相关资源
    最近更新 更多