简体   繁体   English

如何在WPF中动态更改Windows打印机PrintableArea的宽度和高度

[英]How to change windows printer PrintableArea Width and height dynamically in wpf

When take Printout the page size width=816.0,hieght=10560.0.now i want to reduce this size. 当采取Printout时,页面大小width = 816.0,hieght = 10560.0.now我想减小此大小。

    PrintDialog dialog = new PrintDialog();
    double _width = dialog.PrintableAreaWidth;
    double _hieght = dialog.PrintableAreaWidth;
    dialog.PrintVisual(this, "My Window");

With this code i can _width=816.0 and _hieght=10560.0. 使用此代码,我可以_width = 816.0和_hieght = 10560.0。 Now i want to change the PrintableArea Width and height dynamically in wpf.What should i do for that. 现在我想在wpf中动态更改PrintableArea Width和height。我应该怎么做。

在此处输入图片说明

Currently the SnagIt 8 is selected .if i click Print button in above figure.I will get one image. 目前选择了SnagIt8。如果单击上图中的“打印”按钮,我将得到一张图像。 that image has size width 1200px and height 2128px.So i need change this size. 该图像的宽度为1200px,高度为2128px。因此,我需要更改此尺寸。

You need to create a custom DocumentPaginator class as in this SO question (it was about implementing a PrintPreview). 您需要像此SO问题中那样创建自定义DocumentPaginator类(这是关于实现PrintPreview的)。 and use it with the PrintDialog.PrintDocument Method. 并将其与PrintDialog.PrintDocument方法一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM