469,268 Members | 1,021 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,268 developers. It's quick & easy.

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 3679
"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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Randy | last post: by
16 posts views Thread by | last post: by
11 posts views Thread by Adam Right | last post: by
6 posts views Thread by Stuart Nathan | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.