zoukankan      html  css  js  c++  java
  • WPF中的文档打印

    C#代码:
        string printFileName = @"C:/TestForPrint.xps";
        public void InvokePrint(object sender, RoutedEventArgs e)
        {
            // 打印对话框,设置属性
            PrintDialog pDialog = new PrintDialog();
            pDialog.PageRangeSelection = PageRangeSelection.AllPages;
            pDialog.UserPageRangeEnabled = true;
            // 这里你还可以设置对话框的MaxPage, MinPage, PageRange, PrintableAreaHeight, PrintableAreaWidth, PrintQueue, PrintTicket属性值等。
            // 显示对话框,如果用户点击“打印”按钮,则返回true。
            Nullable<Boolean> print = pDialog.ShowDialog();
            if (print == true)
            {
                XpsDocument xpsDocument = new XpsDocument(printFileName, FileAccess.ReadWrite);
                FixedDocumentSequence fixedDocSeq = xpsDocument.GetFixedDocumentSequence();
                pDialog.PrintDocument(fixedDocSeq.DocumentPaginator, "Test print");
            }
        } 

  • 相关阅读:
    安装redis
    memcached复制-repcached
    memcached一致性哈希及php客户端实现
    安装php
    安装mysql
    安装apache
    putty配色方案
    virtualbox下centos实现主宿互访
    安装memcached
    linux网络、性能相关命令
  • 原文地址:https://www.cnblogs.com/luluping/p/2605778.html
Copyright © 2011-2022 走看看