以编程方式更改PCL6打印机上的双面设置(相对于默认值)

时间:2018-07-15 23:15:03

标签: c# printing ms-word office-interop

我想以编程方式更改双工设置。但是花了近一个星期的时间后,我仍然找不到解决方案。

当前,我只想进行单面打印(与默认的双面打印设置相反)。

我尝试了几乎所有解决方案。我的测试代码片段如下:

using System;
using System.Collections.Generic;
using System.IO;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Write the path of the old file folder: ");
            string pathA = Console.ReadLine();

            Console.Write("Write the path of the new file folder: ");
            string pathB = Console.ReadLine();
            Console.WriteLine("Press Enter to continue:");

            List<string> folderA = new List<string>();
            foreach (string filePath in Directory.GetFiles(pathA))
            {
                folderA.Add(Path.GetFileName(filePath));
            }

            List<string> folderB = new List<string>();
            foreach (string filePath in Directory.GetFiles(pathB))
            {
                folderB.Add(Path.GetFileName(filePath));
            }

            Console.Write("New files in folder" + pathA + " : ");
            Print(folderA, folderB);

            Console.WriteLine("------------------------------------");

            Console.Write("New files in folder" + pathB + " : ");
            Print(folderB, folderA);

            Console.Read();
        }

        static void Print(List<string> lstA, List<string> lstB)
        {
            foreach (string fileName in lstA)
            {
                if (!lstB.Contains(fileName))
                {
                    Console.Out.WriteLine(fileName);
                }
            }
        }
    }
}

1 个答案:

答案 0 :(得分:0)

抱歉,已经过去了很长的一周,我还没来得及回复。无论如何,我去查找结构并遇到了这个问题:

https://blogs.msdn.microsoft.com/vsod/2012/05/18/how-to-set-duplex-printing-for-microsoft-word-automation-clients-in-c-vb-net/

我相信这正是您想要的。