如何使用System.printing获取纸张尺寸,颜色模式,...? [英] How to get paper size, color mode,... using System.printing ?

查看:147
本文介绍了如何使用System.printing获取纸张尺寸,颜色模式,...?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在打印文档时,我试图获取纸张尺寸和颜色,但是值始终相同,是打印机的默认设置,而不是我当前的工作.

I'm trying to get the paper size and color when a document is printed but the values are allways the same, the default of the printer, and not my current job.

这是我的代码:


      PrintQueueCollection myPrintQueues = new LocalPrintServer().GetPrintQueues();

      foreach (PrintQueue pq in myPrintQueues)
      {
        pq.Refresh();
        textBox1.AppendText("\r\nName" + pq.Name);

        

        PrintJobInfoCollection jobs = pq.GetPrintJobInfoCollection();

        foreach (PrintSystemJobInfo job in jobs)
        {
          
          PrintPropertyDictionary jobProperties = job.PropertiesCollection;

          foreach (DictionaryEntry entry in jobProperties)
          {
            
            textBox1.AppendText("\r\nQueue:" + pq.Name);
            PrintJobSettings jobSettings = pq.CurrentJobSettings;

            textBox1.AppendText("\r\njob paper size: " + jobSettings.CurrentPrintTicket.PageMediaSize.ToString());
            textBox1.AppendText("\r\njob color: " + jobSettings.CurrentPrintTicket.OutputColor);

 
          }

        }

      }

推荐答案

嗨Pierre,

 

欢迎来到MSDN论坛!

 

我正在将您的话题移至"C#通用论坛"以便您可以获得更多有用的信息.


这篇关于如何使用System.printing获取纸张尺寸,颜色模式,...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆