Solved

PrintPreviewDialog Prints Blank Pages

Posted on 2007-11-26
1
682 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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 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

10 Experts available now in Live!

Get 1:1 Help Now