473,387 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Print preview prints blank page

The print preview dialog will display the preview of the document but will
print a blank page when the print icon is clicked. Printing is fine
otherwise. Can i set the print icon in the printpreviewdialog to go to the
printdialog.
Nov 21 '05 #1
3 8592
Chase,
The print button just calls Print again on the PrintDocument. You need
to manage your datastream for the printing calls such that this resets the
data stream position to the start of your data. Providing an override for
OnBeginPrint is the standard way to do this.

Ron Allen
"Chase" <Ch***@discussions.microsoft.com> wrote in message
news:25**********************************@microsof t.com...
The print preview dialog will display the preview of the document but will
print a blank page when the print icon is clicked. Printing is fine
otherwise. Can i set the print icon in the printpreviewdialog to go to
the
printdialog.

Nov 21 '05 #2
* "=?Utf-8?B?Q2hhc2U=?=" <Ch***@discussions.microsoft.com> scripsit:
The print preview dialog will display the preview of the document but will
print a blank page when the print icon is clicked. Printing is fine
otherwise. Can i set the print icon in the printpreviewdialog to go to the
printdialog.


<URL:http://dotnet.mvps.org/dotnet/samples/printing/downloads/PrintingDemo.zip>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #3
Chase,
Since you are using a StreamReader you can just close it and reopen it.
Or just pass in the name of the text file and always open the stream in
OnBeginPrint and close it in OnEndPrint where you can also clean up
allocated fonts that you use.
Allocate/open things in OnBeginPrint and clean up everything in
OnEndPrint and you should have a document that doesn't leak any resources
and where the Print method can be called without a problem.

Ron Allen
"Chase" <Ch***@discussions.microsoft.com> wrote in message
news:5E**********************************@microsof t.com...
Ok i have the override set up. I am using a streamreader to read a text
document, how do i reset the reader to the begining ofthefile.

Thank you,
Chase

"Ron Allen" wrote:
Chase,
The print button just calls Print again on the PrintDocument. You
need
to manage your datastream for the printing calls such that this resets
the
data stream position to the start of your data. Providing an override
for
OnBeginPrint is the standard way to do this.

Ron Allen
"Chase" <Ch***@discussions.microsoft.com> wrote in message
news:25**********************************@microsof t.com...
> The print preview dialog will display the preview of the document but
> will
> print a blank page when the print icon is clicked. Printing is fine
> otherwise. Can i set the print icon in the printpreviewdialog to go to
> the
> printdialog.


Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Benjamin | last post by:
I have a weird behavior occuring in IE 6.0. I am trying to use HTML to display documents to a user, but then also have it sent directly to the printer and have it look similiar (I know probably...
2
by: Craig Scheets | last post by:
I have writting an application that prints fine, but I have to do a TranslateTransform on the graphics in the OnPagePrint event to get place output at exact X,Y (the application prints checks and...
0
by: B-Dog | last post by:
I'm using the code from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/printwinforms.asp to print some info from a database and I've struggled through customizing...
4
by: Marcos Beccar Varela | last post by:
Hello to all, I have this form with a PrintDocument named prt_doc, theproblem is that when I invoke the prt_doc.print() it only prints the las page, and not multiple pages. I Also Have a Preview...
0
by: Nina | last post by:
Hi there, I use PrintPreviewDialog to preview text of a textbox. It shows pages of text very well in PrintpPreviewDialog. But when I click the Print button on the dialog, it prints one blank...
0
by: Phil | last post by:
When I print an aspx page built in Asp.Net 2.0 (c# - Visual Studios 2005) the resulting print page is cut-off. Anything that spans too far to the right, or to far down is clipped - multiple pages...
6
by: CSharpguy | last post by:
In my gridview I have 2 -3 template fields which are hyperlinks. I allow the user to print this grid. When the grid prints it also prints the links, how can I take the user to a print preview page...
1
by: =?Utf-8?B?UGxheWE=?= | last post by:
I am using a print preview dialog in my program and when there are multiple pages and you press the print button it only prints one page. How can I get it to print all pages when you press the...
2
by: Brad Pears | last post by:
I have some sample code that uses the print dialog, print preview and a print direct options. If I select print preview and then click the printer icon from that, the document prints. If I...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.