473,657 Members | 2,535 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PrintPreview?

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
11 2356
Adam,

Without seeing your code, it's impossible to say. You might have a bug
in your code.

Can you post a complete example?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Adam Right" <ad**@right.com > wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
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 #2
Hi,

Hi,

My code is on the below,

m_PrintDocument = new PrintDocument( );
m_PrintDocument .PrintPage += new PrintPageEventH andler(
m_PrintDocument _PrintPage );
PrintPreviewDia log printPreviewDia log1 = new PrintPreviewDia log ( );
printPreviewDia log1.Document = m_PrintDocument ;
Form m_Temp = ( Form ) printPreviewDia log1;
m_Temp.WindowSt ate = FormWindowState .Maximized;
printPreviewDia log1.ShowDialog ( );

void m_PrintDocument _PrintPage( object sender, PrintPageEventA rgs e )
{
Font printFont = new Font ( "Courier" , 10 , FontStyle.Regul ar );
String myString = "Trying";
e.Graphics.Draw String( myString, printFont, Brushes.Black, 0, 0, new
StringFormat( ) );
}

The printPreview dialog does not print my document although there are words
on the document.
Thanks..
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Adam,

Without seeing your code, it's impossible to say. You might have a bug
in your code.

Can you post a complete example?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Adam Right" <ad**@right.com > wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
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 #3
Hi,

can you give your mail address. I want to send yo an attachment in which
there is a screen shot about this problem....

"Adam Right" <ad**@right.com > wrote in message
news:Ox******** ******@TK2MSFTN GP14.phx.gbl...
Hi,

Hi,

My code is on the below,

m_PrintDocument = new PrintDocument( );
m_PrintDocument .PrintPage += new PrintPageEventH andler(
m_PrintDocument _PrintPage );
PrintPreviewDia log printPreviewDia log1 = new PrintPreviewDia log ( );
printPreviewDia log1.Document = m_PrintDocument ;
Form m_Temp = ( Form ) printPreviewDia log1;
m_Temp.WindowSt ate = FormWindowState .Maximized;
printPreviewDia log1.ShowDialog ( );

void m_PrintDocument _PrintPage( object sender, PrintPageEventA rgs e )
{
Font printFont = new Font ( "Courier" , 10 , FontStyle.Regul ar );
String myString = "Trying";
e.Graphics.Draw String( myString, printFont, Brushes.Black, 0, 0, new
StringFormat( ) );
}

The printPreview dialog does not print my document although there are
words on the document.
Thanks..
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote
in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Adam,

Without seeing your code, it's impossible to say. You might have a
bug in your code.

Can you post a complete example?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Adam Right" <ad**@right.com > wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
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 #4
Adam,

You can post it here, and I will see it. No need to hide it from the
rest of the group.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Adam Right" <ad**@right.com > wrote in message
news:ey******** ******@TK2MSFTN GP11.phx.gbl...
Hi,

can you give your mail address. I want to send yo an attachment in which
there is a screen shot about this problem....

"Adam Right" <ad**@right.com > wrote in message
news:Ox******** ******@TK2MSFTN GP14.phx.gbl...
Hi,

Hi,

My code is on the below,

m_PrintDocument = new PrintDocument( );
m_PrintDocument .PrintPage += new PrintPageEventH andler(
m_PrintDocument _PrintPage );
PrintPreviewDia log printPreviewDia log1 = new PrintPreviewDia log ( );
printPreviewDia log1.Document = m_PrintDocument ;
Form m_Temp = ( Form ) printPreviewDia log1;
m_Temp.WindowSt ate = FormWindowState .Maximized;
printPreviewDia log1.ShowDialog ( );

void m_PrintDocument _PrintPage( object sender, PrintPageEventA rgs e )
{
Font printFont = new Font ( "Courier" , 10 , FontStyle.Regul ar );
String myString = "Trying";
e.Graphics.Draw String( myString, printFont, Brushes.Black, 0, 0, new
StringFormat( ) );
}

The printPreview dialog does not print my document although there are
words on the document.
Thanks..
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote
in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Adam,

Without seeing your code, it's impossible to say. You might have a
bug in your code.

Can you post a complete example?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Adam Right" <ad**@right.com > wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
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 #5
Nicholas,

I prepared a response for Adam, telling him that he was using
PrintDocument incorrectly. Then I read the "about PrintDocument"
documentation for the .NET Framework 1.1, and found that he was
following their instructions exactly. This let to a question:

Do you know whether PrintPreviewDia log, when you choose "Print..." from
the menu, re-uses the original instance of the PrintDocument you pass
it, or instantiates a new PrintDocument for the printing process
itself?

I ask because I've always inherited from PrintDocument and overridden
OnPrintPage, rather than handling the PrintPage event of a "vanilla"
PrintDocument. The former approach has always worked for me. However,
if PrintPreviewDia log instantiates a _new_ PrintDocument instance
internally in order to print, the latter method (the method recommended
by MS in its documentation) _won't_ work.

Jan 2 '06 #6
Hi,

Is there a basic solution for this problem, i cannot understand complex
english sorry...

"Bruce Wood" <br*******@cana da.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Nicholas,

I prepared a response for Adam, telling him that he was using
PrintDocument incorrectly. Then I read the "about PrintDocument"
documentation for the .NET Framework 1.1, and found that he was
following their instructions exactly. This let to a question:

Do you know whether PrintPreviewDia log, when you choose "Print..." from
the menu, re-uses the original instance of the PrintDocument you pass
it, or instantiates a new PrintDocument for the printing process
itself?

I ask because I've always inherited from PrintDocument and overridden
OnPrintPage, rather than handling the PrintPage event of a "vanilla"
PrintDocument. The former approach has always worked for me. However,
if PrintPreviewDia log instantiates a _new_ PrintDocument instance
internally in order to print, the latter method (the method recommended
by MS in its documentation) _won't_ work.

Jan 2 '06 #7
I have a potential solution, but it will have to wait until tomorrow,
when I will be back in the office and will have a printer with which to
test.

I want to write a little test program to discover whether my theory is
correct.

Jan 2 '06 #8
Adam,
Since you are putting the text at 0,0 on the page you may be outside the
'hard margin' of the printer and thus not printing anything. Try it again
with 100, 100 which should be 1" down and 1" right from the page edge using
the standard coordinates. Alternately you could try setting OriginAtMargins
to true for the PrintDocument (I think).

Ron Allen
"Adam Right" <ad**@right.com > wrote in message
news:Ox******** ******@TK2MSFTN GP14.phx.gbl...
Hi,

Hi,

My code is on the below,

m_PrintDocument = new PrintDocument( );
m_PrintDocument .PrintPage += new PrintPageEventH andler(
m_PrintDocument _PrintPage );
PrintPreviewDia log printPreviewDia log1 = new PrintPreviewDia log ( );
printPreviewDia log1.Document = m_PrintDocument ;
Form m_Temp = ( Form ) printPreviewDia log1;
m_Temp.WindowSt ate = FormWindowState .Maximized;
printPreviewDia log1.ShowDialog ( );

void m_PrintDocument _PrintPage( object sender, PrintPageEventA rgs e )
{
Font printFont = new Font ( "Courier" , 10 , FontStyle.Regul ar );
String myString = "Trying";
e.Graphics.Draw String( myString, printFont, Brushes.Black, 0, 0, new
StringFormat( ) );
}

The printPreview dialog does not print my document although there are
words on the document.
Thanks..
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote
in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Adam,

Without seeing your code, it's impossible to say. You might have a
bug in your code.

Can you post a complete example?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Adam Right" <ad**@right.com > wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
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 3 '06 #9
Hi Ron,

I have tried that but the printed document still is empty. I do not
understand that if there are some words on the preview, what is the reason
that it does not print that words? in Beta 2, i can print with the same
code. So i am wondering about Framework 2.0 in which there may be a bug in
print document. I do not know how can i handle that problem, because it is
very important for me and my customers. Thanks...

"Ron Allen" <Ro******@newsg roups.nospam> wrote in message
news:O$******** *****@TK2MSFTNG P10.phx.gbl...
Adam,
Since you are putting the text at 0,0 on the page you may be outside
the 'hard margin' of the printer and thus not printing anything. Try it
again with 100, 100 which should be 1" down and 1" right from the page
edge using the standard coordinates. Alternately you could try setting
OriginAtMargins to true for the PrintDocument (I think).

Ron Allen
"Adam Right" <ad**@right.com > wrote in message
news:Ox******** ******@TK2MSFTN GP14.phx.gbl...
Hi,

Hi,

My code is on the below,

m_PrintDocument = new PrintDocument( );
m_PrintDocument .PrintPage += new PrintPageEventH andler(
m_PrintDocument _PrintPage );
PrintPreviewDia log printPreviewDia log1 = new PrintPreviewDia log ( );
printPreviewDia log1.Document = m_PrintDocument ;
Form m_Temp = ( Form ) printPreviewDia log1;
m_Temp.WindowSt ate = FormWindowState .Maximized;
printPreviewDia log1.ShowDialog ( );

void m_PrintDocument _PrintPage( object sender, PrintPageEventA rgs e )
{
Font printFont = new Font ( "Courier" , 10 , FontStyle.Regul ar );
String myString = "Trying";
e.Graphics.Draw String( myString, printFont, Brushes.Black, 0, 0, new
StringFormat( ) );
}

The printPreview dialog does not print my document although there are
words on the document.
Thanks..
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote
in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Adam,

Without seeing your code, it's impossible to say. You might have a
bug in your code.

Can you post a complete example?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Adam Right" <ad**@right.com > wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
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 3 '06 #10

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

Similar topics

1
2014
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 "wingdings".
1
2014
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. There's something I'm doing wrong. Can someone give me some code to print a simple string in the PrintPreview dialog box? Thanks
0
1153
by: sachin | last post by:
When we view any document in print preview dialog, where does it save the document? such that when me move to next/previous page where it reads the information from . If a heavy document like RTF file having images and large number of pages is viewed in PrintPreview, does it affects the system speed? What happens at application level please guid regard
1
1648
by: Dev2004 | last post by:
Hello, Does anyone have any examples on how I could show the contents of the TreeView in a PrintPreview window. I've looked at the PrintPreviewDialog control but could not see how I could link the TreeView control to it. I'm assumming I've got to print the pages myself. Thanks,
9
3805
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 "print" button, i cannot print the document although there is some words on the preview. So, is there a bug in the preview? Thanks...
0
999
by: james | last post by:
While trying to help another programmer on MSDN's Visual Basic 2005 Express Edition forum, he (and I ) ran into a strange problem with the PrintPreview Control in VB2005. If you load a document ( text file in this case) that has more than 12 pages ( I tried with a 50 page document too), instead of being able to see all 12+ pages in the Preview Window, all you see are Blank Pages!! But, preview a document with less than that, it will show...
0
1924
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 asp.net/web application) I can't find the printpreview... So, the question is: Is there a way for me to use printpreview for Ultrawebgrid (just like when I'm using UltraGrid)? Note: 1. UltraGrid & UltraWebGrid are components from Infragistics.
6
1471
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
2103
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 so I am using PrintPreviewDialog. It prints fine. But the PrintPreview dialog shows only one blank page. Before I resort to posting code, is there some simple and/or common mistake I could have made which would explain why PrintPreview shows...
0
8324
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7352
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2742
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.