【问题标题】:Set page format in WPF FlowDocument for dot matrix printer在 WPF FlowDocument 中为点阵打印机设置页面格式
【发布时间】:2013-09-02 23:14:58
【问题描述】:

我在使用 FlowDocuments 构建的报告时遇到问题。我无法设置点阵打印机纸张的格式(它们大于 A4)。 例如,当我打印报表时(它有多个页面,并且包含不同的 FlowDocument 对象),第二页从第一个工作表的页脚开始。另外,我尝试使用 A4 纸,打印正常,所以我想知道是否有办法将 FlowDocument 页面设置为该尺寸。

谢谢!

【问题讨论】:

    标签: wpf printing flowdocument


    【解决方案1】:

    在打印之前,您必须如下设置 FlowDocument 的 DocumentPaginator 的 PageSize:

            PrintDialog printDialog = new PrintDialog();
            if (printDialog.ShowDialog() == true)
            {
                    //Other settings
                    DocumentPaginator paginator = ((IDocumentPaginatorSource)FlowDocument).DocumentPaginator;
                    paginator.PageSize = new Size(816,1056) //Set the size of A4 here accordingly
                    printDialog.PrintDocument(paginator, "My");
    
            }
    

    希望这会有所帮助。 谢谢

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-09-25
      • 1970-01-01
      • 1970-01-01
      • 2011-05-14
      • 2023-04-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多