473,322 Members | 1,379 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,322 software developers and data experts.

Urgent PrintPreview Error?

Hi,

I am using .Net Framework 2.0 final, and i use .Net printing library to
print a document. I use printPreview dialog to print the document but after
preview was shown, when i press the "print" button, i cannot print the
document although there is some words on the preview. So, is there a bug in
the preview?

Thanks...
Jan 2 '06 #1
9 3793
"Adam Right" <ad**@right.com> ha scritto nel messaggio
news:uu**************@TK2MSFTNGP14.phx.gbl...

I am using .Net Framework 2.0 final, and i use .Net printing library to
print a document. I use printPreview dialog to print the document but after preview was shown, when i press the "print" button, i cannot print the
document although there is some words on the preview. So, is there a bug in the preview?


did you detach the PrintDocument events?

Do you get an exception or the document simply is not printed?

--
Free .Net Reporting tool: http://www.neodatatype.net
Jan 2 '06 #2
Hi,

My code is on the below,

m_PrintDocument = new PrintDocument( );
m_PrintDocument.PrintPage += new PrintPageEventHandler(
m_PrintDocument_PrintPage );
PrintPreviewDialog printPreviewDialog1 = new PrintPreviewDialog ( );
printPreviewDialog1.Document = m_PrintDocument;
Form m_Temp = ( Form ) printPreviewDialog1;
m_Temp.WindowState = FormWindowState.Maximized;
printPreviewDialog1.ShowDialog ( );

void m_PrintDocument_PrintPage( object sender, PrintPageEventArgs e )
{
Font printFont = new Font ( "Courier" , 10 , FontStyle.Regular );
String myString = "Trying";
e.Graphics.DrawString( myString, printFont, Brushes.Black, 0, 0, new
StringFormat( ) );
}

"Zanna" <zn*******@virgilio.it> wrote in message
news:43**********************@reader3.news.tin.it. ..
"Adam Right" <ad**@right.com> ha scritto nel messaggio
news:uu**************@TK2MSFTNGP14.phx.gbl...

I am using .Net Framework 2.0 final, and i use .Net printing library to
print a document. I use printPreview dialog to print the document but

after
preview was shown, when i press the "print" button, i cannot print the
document although there is some words on the preview. So, is there a bug

in
the preview?


did you detach the PrintDocument events?

Do you get an exception or the document simply is not printed?

--
Free .Net Reporting tool: http://www.neodatatype.net

Jan 2 '06 #3
"Adam Right" <ad**@right.com> ha scritto nel messaggio
news:e5**************@TK2MSFTNGP14.phx.gbl...
Hi,

My code is on the below,


[Snip]
This works perfect to me:
class Printer {

public void Print()

{

PrintDocument m_PrintDocument = new PrintDocument();

m_PrintDocument.PrintPage += new
PrintPageEventHandler(m_PrintDocument_PrintPage);

PrintPreviewDialog printPreviewDialog1 = new PrintPreviewDialog();

printPreviewDialog1.Document = m_PrintDocument;

Form m_Temp = (Form)printPreviewDialog1;

m_Temp.WindowState = FormWindowState.Maximized;

printPreviewDialog1.ShowDialog();

}

void m_PrintDocument_PrintPage( object sender, PrintPageEventArgs e )

{

Font printFont = new Font ( "Courier" , 10 , FontStyle.Regular );

String myString = "Trying";

e.Graphics.DrawString( myString, printFont, Brushes.Black, 0, 0, new

StringFormat( ) );

}

}
--
Free .Net Reporting tool: http://www.neodatatype.net
Jan 2 '06 #4
Hi,

I think so, but i cannot use the printpreview print button to print the
document. It gives me an empty page although there is some words in the
document. It works fine before i installed .Net 2.0 final. Is it about
framework?

"Zanna" <zn*******@virgilio.it> wrote in message
news:43**********************@reader3.news.tin.it. ..
"Adam Right" <ad**@right.com> ha scritto nel messaggio
news:e5**************@TK2MSFTNGP14.phx.gbl...
Hi,

My code is on the below,


[Snip]
This works perfect to me:
class Printer {

public void Print()

{

PrintDocument m_PrintDocument = new PrintDocument();

m_PrintDocument.PrintPage += new
PrintPageEventHandler(m_PrintDocument_PrintPage);

PrintPreviewDialog printPreviewDialog1 = new PrintPreviewDialog();

printPreviewDialog1.Document = m_PrintDocument;

Form m_Temp = (Form)printPreviewDialog1;

m_Temp.WindowState = FormWindowState.Maximized;

printPreviewDialog1.ShowDialog();

}

void m_PrintDocument_PrintPage( object sender, PrintPageEventArgs e )

{

Font printFont = new Font ( "Courier" , 10 , FontStyle.Regular );

String myString = "Trying";

e.Graphics.DrawString( myString, printFont, Brushes.Black, 0, 0,
new

StringFormat( ) );

}

}
--
Free .Net Reporting tool: http://www.neodatatype.net

Jan 2 '06 #5
"Adam Right" <ad**@right.com> ha scritto nel messaggio
news:e6**************@TK2MSFTNGP14.phx.gbl...
I think so, but i cannot use the printpreview print button to print the
document. It gives me an empty page although there is some words in the
document. It works fine before i installed .Net 2.0 final. Is it about
framework?


I used the code I wrote with VS.Net 2005, so, against fw 2.0 final.

Did you tryied my code (that, after all is your) simply using:

Printer p = new Printer();
p.Print();

?

When I print the page it is printed correctly.

--
Free .Net Reporting tool: http://www.neodatatype.net
Jan 2 '06 #6
Hi,

Do you think that it is the solution? I think it cannot be accepted that the
print button of the printpreview form is not working although there are
words on the document. Is it a bug? The printpreview dialog must print the
document. What do you think really i wonder about it?
Thanks...
"Zanna" <zn*******@virgilio.it> wrote in message
news:43**********************@reader3.news.tin.it. ..
"Adam Right" <ad**@right.com> ha scritto nel messaggio
news:e6**************@TK2MSFTNGP14.phx.gbl...
I think so, but i cannot use the printpreview print button to print the
document. It gives me an empty page although there is some words in the
document. It works fine before i installed .Net 2.0 final. Is it about
framework?


I used the code I wrote with VS.Net 2005, so, against fw 2.0 final.

Did you tryied my code (that, after all is your) simply using:

Printer p = new Printer();
p.Print();

?

When I print the page it is printed correctly.

--
Free .Net Reporting tool: http://www.neodatatype.net

Jan 2 '06 #7
"Adam Right" <ad**@right.com> ha scritto nel messaggio
news:uU*************@TK2MSFTNGP10.phx.gbl...

Do you think that it is the solution? I think it cannot be accepted that the print button of the printpreview form is not working although there are
words on the document.


I really don't understand.
The code I posted is working or not?

If it is working where is the problem?

--
Free .Net Reporting tool: http://www.neodatatype.net
Jan 2 '06 #8
The problem is not that the document will not print correctly.

The problem is that using the Print... menu item from
PrintPreviewDialog causes it to be printed _twice_: once to display in
the print preview, then again to print on the printer. The document is
not printing properly the second time, when PrintPreviewDialog tries to
print it again to the printer.

So, your test is inadequate: you are only trying to print the document
once, using .Print().

We have another thread going on this problem. I suggest that we abandon
this discussion and concentrate on that other thread.

Jan 2 '06 #9
Hi,

Ok, i can use Print() function to print the document but i have to show the
documents that will be printed to the user. The reason is that user may or
not print the document he/she has to see the document. So by using Print()
function how can i show the print document either?
Thanks...

"Bruce Wood" <br*******@canada.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
The problem is not that the document will not print correctly.

The problem is that using the Print... menu item from
PrintPreviewDialog causes it to be printed _twice_: once to display in
the print preview, then again to print on the printer. The document is
not printing properly the second time, when PrintPreviewDialog tries to
print it again to the printer.

So, your test is inadequate: you are only trying to print the document
once, using .Print().

We have another thread going on this problem. I suggest that we abandon
this discussion and concentrate on that other thread.

Jan 3 '06 #10

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

Similar topics

1
by: LARB | last post by:
Good morning, I have a print routine where I use a "printpreview dialog' control. The text is perfect BUT when I then print the job all the text is completely crazy, a bit like...
1
by: Randy | last post by:
Hello, I'm trying to print a simple string using the PrintPreviewDialog. I get the string to show up in the PrintPreview dialog, but when I click the Printer icon, it just prints a blank page....
16
by: | last post by:
Hi all, I have a website running on beta 2.0 on server 2003 web sp1 and I keep getting the following error:- Error In:...
1
by: max | last post by:
Is this a framework question? vs a VB.Net question? I'm getting an unhandled exception in oPreview that isn't caught by the Try. Any ideas on how surround this puppy?? <SNIP> Dim oPreview...
11
by: Adam Right | last post by:
Hi, I am using .Net Framework 2.0 final, and i use .Net printing library to print a document. I use printPreview dialog to print the document but after preview was shown, when i press the...
0
by: Joxie | last post by:
Hi, All! Recently I'm using ultrawebgrid for my projects... While I try Ultragrid (for windows application) I could call printpreview as ultragrid function, but while I'm using Ultrawebgrid (for...
6
by: Stuart Nathan | last post by:
Can someone tell me how to remove a previously loaded PrintDocument in a PrintPreview control, so that I can display a nedw one?
2
by: eBob.com | last post by:
I have a print application modeled on a program which I found via this newsgroup. (I still have comments in German in it!) The model uses ExtendedPrintPreviewDialog but I don't seem to have that...
0
by: vench | last post by:
Hi! I have a vb.net project that uses mozilla activeX control, there is no problem in navigating or loading the url in the control, the problem that I have encountered is when printpreview using the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.