我的用户从计算机上的不同打印机在 word、excel 或例如 ERP 系统等应用程序中打印文件(PDF、docx 等)。我需要将此文件复制到特定文件夹以将它们保存在存储中。
这是我当前的代码。
using System.Management;
bool NewPrintJob = false;
string wmiQuery = "SELECT * FROM Win32_PrintJob";
ManagementObjectSearcher jobsSearcher = new
ManagementObjectSearcher(wmiQuery);
ManagementObjectCollection jobCollection = null;
List<PrintJob> printJobs = new List<PrintJob>();
while (!NewPrintJob)
{
jobCollection = jobsSearcher.Get();
NewPrintJob = jobCollection.Count > 0; //New Print Job?
}
编辑
但是如何访问文档以将其保存到用户在打印时选择的文件格式的文件夹中?
开发语言不需要是 C# 或 C++。