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;
    
    
                }
            }
  • 相关阅读:
    支付宝H5、APP支付服务端的区别(php)
    微信小程序快速转成百度小程序的方法
    pm2命令管理启动的nodejs项目进程
    CentOS7 宝塔搭配git 实时更新项目源码
    CentOS7 搭建GIT环境
    Json数据交互
    HTML标签大全
    Java集合
    JavaSE基础知识
    idea2019版本及以下全家桶永久破解
  • 原文地址:https://www.cnblogs.com/nocanstillbb/p/9081230.html
Copyright © 2011-2022 走看看