Printing Question Rephrased

B

Boreas

public void doThePrinting()
{
try
{
PrintDocument pd = new PrintDocument();
pd.PrintPage += new
PrintPageEventHandler(this.PrintPageEvent); // ****
pd.Print();
}
catch // some code
{
// some code
}
}

private void PrintPageEvent(object sender, PrintPageEventArgs ev)
{
// ****
}

The printing code I see in tutorials uses a printing dialogue,
but the essence of the printing is left to be coded (****) by the developer
this seems inconsistent (printing dialogie, without any printing
functionality).
Is there a way around this?
 
J

Jeff Johnson

public void doThePrinting()
{
try
{
PrintDocument pd = new PrintDocument();
pd.PrintPage += new
PrintPageEventHandler(this.PrintPageEvent); // ****
pd.Print();
}
catch // some code
{
// some code
}
}

private void PrintPageEvent(object sender, PrintPageEventArgs ev)
{
// ****
}

The printing code I see in tutorials uses a printing dialogue,
but the essence of the printing is left to be coded (****) by the
developer
this seems inconsistent (printing dialogie, without any printing
functionality).
Is there a way around this?

No, not really. And before you think this is a limitation of C#/.NET, just
about every language I've written Windows programs in works the same way
(C[++]/VB*/C#). Printing is basically "drawing to the printer instead of the
screen." Software has no way of knowing what you want to draw, so it's up to
you to send the commands to do the drawing. The dialog is merely a
consistent way of taking common user preferences. It has no way of knowing
what you actually want to PRINT.

Without using a third-party library (which are generally geared towards
reports and not generic printing) it's really all up to you.



*VB does have a function called PrintForm, which merely prints a
(lousy-resolution) snapshot of the current window. It's crap.
 
B

Boreas

Jeff Johnson said:
public void doThePrinting()
{
try
{
PrintDocument pd = new PrintDocument();
pd.PrintPage += new
PrintPageEventHandler(this.PrintPageEvent); // ****
pd.Print();
}
catch // some code
{
// some code
}
}

private void PrintPageEvent(object sender, PrintPageEventArgs ev)
{
// ****
}

The printing code I see in tutorials uses a printing dialogue,
but the essence of the printing is left to be coded (****) by the
developer
this seems inconsistent (printing dialogie, without any printing
functionality).
Is there a way around this?

No, not really. And before you think this is a limitation of C#/.NET, just
about every language I've written Windows programs in works the same way
(C[++]/VB*/C#). Printing is basically "drawing to the printer instead of
the screen." Software has no way of knowing what you want to draw, so it's
up to you to send the commands to do the drawing. The dialog is merely a
consistent way of taking common user preferences. It has no way of knowing
what you actually want to PRINT.

Without using a third-party library (which are generally geared towards
reports and not generic printing) it's really all up to you.

Yes, I wrote a library for printing in the past which works fine, but the
apparant inconsistency kept puzzeling me, so I decided to find out,
expecting that I was doing things in a clumsy way. Apparently not.

OK, I have the answer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top