Solved

PrintPreviewDialog Prints Blank Pages

Posted on 2007-11-26
1
685 Views
Last Modified: 2013-12-16
C#.Net 2005
Visual Studio 2005 Pro

We are developing a form that prints generated values.  When we use this code _pd.Print(); the report prints perfectly, and when we use this code:

PrintPreviewDialog ppd = new PrintPreviewDialog();
            ppd.Document = _pd;
            ppd.ShowDialog();

the preview is perfect, but only a few lines print when the user click print.

And thats the problem.
0
Comment
Question by:bmiller250
1 Comment
 
LVL 18

Accepted Solution

by:
jcoehoorn earned 500 total points
ID: 20352692
Let me make sure I understand this:
   If you print without previewing, it's correct.
   If you preview it's correct.
   If you preview and then print it's wrong.

Can I also assume that the same code runs (the print_page event) regardless of which case you use?  If that's the case, the problem is probably that something isn't being reset correctly in your print_page code, so when you print after previewing the code thinks it's already done.  You probably have variables to track what page you're on or where you are at in the document that persist between pages.  At least one variable like this is not reset correctly.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now