在一个WPF / C#应用程序中,我使用DocumentPaginator打印一些页面。但是,我想在横向和纵向模式下混合1个打印作业页面:例如,纵向模式中的第1页,横向模式中的第2页和纵向模式中的第3页。
但是,如果我更改PageSize (从DocumentPaginator覆盖)以反映景观,则页面仍处于纵向模式。
换句话说,在
public class PrintPaginator : DocumentPaginator
{
public override Size PageSize { get; set; }
public override DocumentPage GetPage(int pageNumber)
{
// size values
Size theSizeOfThePage;
// make size orientation correct
if (pageNumber == 2)
{
// landscape: width is larger then height
theSizeOfThePage = new Size(Math.Max(PageSize.Width, PageSize.Height), Math.Min(PageSize.Width, PageSize.Height));
}
else
{
// portrait: height is larger then width
theSizeOfThePage = new Size(Math.Min(PageSize.Width, PageSize.Height), Math.Max(PageSize.Width, PageSize.Height));
}
PageSize = theSizeOfThePage;
// set the grid as the page to print
thePage = new Grid();
thePage.Width = PageSize.Width;
thePage.Height = PageSize.Height;
[...]
// return a documentpage wrapping the grid
return new DocumentPage(thePage);
}我相信我不能设置方向或PageSize的景观,因为这取决于正在打印的页码…
有什么想法,建议,工作坊可以在一次打印中混合肖像和风景吗?
谢谢!R.
发布于 2012-07-25 19:03:44
我知道您已经问了很长时间了,但是您是否尝试过在新DocumentPage()调用的构造函数中直接设置PageSize?
更多详情请访问我的博客:http://wieser-software.blogspot.co.uk/2012/07/landscape-printing-and-preview-in-wpf.html
https://stackoverflow.com/questions/7785715
复制相似问题