zoukankan      html  css  js  c++  java
  • WPF 流打印

                PrintDialog printDialog = new PrintDialog();
                if (printDialog.ShowDialog() ==  true)
                {
    
                    System.Printing.PrintCapabilities capabilities = printDialog.PrintQueue.GetPrintCapabilities(printDialog.PrintTicket);
                    // double scale = Math.Min(capabilities.PageImageableArea.ExtentWidth / myscrollvier.ActualWidth, capabilities.PageImageableArea.ExtentHeight /
                    //myscrollvier.ActualHeight);
                    var x1 = flowDocument.PageWidth;
                    var x2 = flowDocument.PageHeight;
                    flowDocument.PageHeight = capabilities.PageImageableArea.ExtentHeight;
                    flowDocument.PageWidth = capabilities.PageImageableArea.ExtentWidth;
    
                    printDialog.PrintDocument(((IDocumentPaginatorSource)flowDocument).DocumentPaginator, "Flow Document Print Job");
    
                    flowDocument.PageHeight = x2;
                    flowDocument.PageWidth = x1;
    
    
                }
            private void Button_Click(object sender, RoutedEventArgs e)
            {
                PrintDialog printDialog = new PrintDialog();
                if (printDialog.ShowDialog() ==  true)
                {
    
                    System.Printing.PrintCapabilities capabilities = printDialog.PrintQueue.GetPrintCapabilities(printDialog.PrintTicket);
                    // double scale = Math.Min(capabilities.PageImageableArea.ExtentWidth / myscrollvier.ActualWidth, capabilities.PageImageableArea.ExtentHeight /
                    //myscrollvier.ActualHeight);
                    var x1 = flowDocument.PageWidth;
                    var x2 = flowDocument.PageHeight;
                    flowDocument.PageHeight = capabilities.PageImageableArea.ExtentHeight;
                    flowDocument.PageWidth = capabilities.PageImageableArea.ExtentWidth;
    
                    printDialog.PrintDocument(((IDocumentPaginatorSource)flowDocument).DocumentPaginator, "Flow Document Print Job");
    
                    flowDocument.PageHeight = x2;
                    flowDocument.PageWidth = x1;
    
    
                }
            }
  • 相关阅读:
    面向对象之类属性、类方法,静态方法
    python面向对象之继承
    python之面向对象练习
    python面向对象
    CentOS7.5最小化安装之后的配置
    怎么在一台电脑上安装win7与centos7双系统
    安装Win7时删除系统保留的100M隐藏分区
    win7在安装时跳过输入用户名界面,直接开启管理员用户
    ESP8266 wifi干扰钓鱼实现
    ESP8266 wifi干扰、钓鱼实现
  • 原文地址:https://www.cnblogs.com/nocanstillbb/p/9081230.html
Copyright © 2011-2022 走看看