TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Pulvertoastman
NA
1
4.7k
Printpreview of Flowdocument truncated
Jul 19 2011 9:38 AM
Hey there,
my goal is to create a print preview in landscape. Therefore, I use a FlowDocument that is shown via a FlowDocumentReader.
XAML snippet to display the reader:
<StackPanel Grid.Row="0" Grid.Column="2"
HorizontalAlignment="Stretch">
<FlowDocumentReader Name="Viewer" Margin="20,20,20,20" Zoom="100"
BorderThickness="1" BorderBrush="Black"
Background="White" HorizontalAlignment="Stretch"/>
</StackPanel>
For some reasons, the text is only shown horizontally until approx. the center of the reader. In order to adapt the page to landscape, I use the following code:
// Adjust the page size.
const double inch = 96;
PrintQueue queue = new PrintQueue(new PrintServer(), printer);
PrintTicket ticket = queue.UserPrintTicket;
ticket.PageOrientation = PageOrientation.Landscape;
double width = ticket.PageMediaSize.Width.Value;
double height = ticket.PageMediaSize.Height.Value;
double leftmargin = 1.25 * inch;
double rightmargin = 1.25 * inch;
double topmargin = 1 * inch;
double bottommargin = 1 * inch;
width = width - leftmargin - rightmargin;
height = height - topmargin - bottommargin;
// Option 1
IDocumentPaginatorSource paginator = document as IDocumentPaginatorSource;
paginator.DocumentPaginator.PageSize = new Size(height, width);
// Option 2
PageMediaSize pageMediaSize = new PageMediaSize(height, width);
ticket.PageMediaSize = pageMediaSize;
I played around with Option 1 and 2 to work around that uissue but without much success. If I toggle to Scrollview, the reader shows the full document.
Any help is appreciated.
Best,
Dirk
Reply
Answers (
1
)
Is there any better option in .net 2005 to make a report other than crystal report
How to speed up printing in crystal report ....