简体   繁体   中英

Allowing user to print specific pages in C# WPF FlowDocument Application

具有禁用打印范围的WPF打印盒

The box above is what is called when a print() method is initiated on a flowDocumentPageViewer of flowDocumentScrollViewer.

In My application, I want my users to be able to select specific page range to print but the options seems to be disabled in the printbox. is there a way I can activate this in code.

Help will be appreciated as this tied to to a project I am doing.

After alot of surfing the internet with no answer, I decided to check out my Library, my best pick was pro WPF 4.5 in c# 4th edition and I got the answer on page 941 chapter 29. Actually have read this before but I did not pick to detail and the author stressed that calling PrintDialog.UserPageRangeEnabled and others should be done before calling PrintDialog.ShowDialog()

I fixed this with that and viola, after months of stress, I got it right.

Although most of the printing features like PrintDialog.currentPageEnabled and PrintDialog.SelectedPagesEnabled are supported only in .NET 4.5 but I'm ok with with the PrintDialog.UserPageRangeEnabled because my app targets .NET 4 CF for I want it to be available to window xp users.

Below is the box now.

使用PrintDialog.UserPageRangeEnabled打印

Please take a look at the following post which explains printing from a FlowDocument :

Printing a WPF FlowDocument

You can find out more from 'Mitesh Sureja's Blog':

Printing Flow Document using WPF PrintDialog

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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