Temitayo
Temitayo

Reputation: 812

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

WPF print box with disabled print rages

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.

Upvotes: 1

Views: 3460

Answers (2)

Temitayo
Temitayo

Reputation: 812

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.

Printing with PrintDialog.UserPageRangeEnabled

Upvotes: 3

Sheridan
Sheridan

Reputation: 69985

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

Upvotes: 2

Related Questions