PrinterSettings() in csharp

G

Guest

I’m not sure how to feed PCL commands (i.e. “Ec&l1Sâ€) thru the
PrinterSettings() function, but we have been successfully using the
PrinterSetting() properties and methods to successfully call on most of the
printer’s properties.

Our understanding was that by using the correct combination of “.Landscapeâ€
and “.Duplex.Horizontal†properties, we would be able to accomplish the “flip
pages upâ€, in which the report is printed in landscape mode, printed on both
sides, and printed in a notebook layout (back side flipped up).

We can’t get this to work properly. We can get the report to
programmatically print landscape and duplex, but the call to flip pages up is
NOT working.

Below is the snippet of code we’re using.
(We have tried various combinations of landscape, portrait, horizontal and
vertical, in the printersettings and printdocument objects in this code).

Any suggestions on this would be greatly appreciated.

//******************************************

PrinterSettings printerSettings = new PrinterSettings();
printerSettings.PrinterName = printerName;
printerSettings.DefaultPageSettings.Landscape=blnLandscape;
printerSettings.Duplex = System.Drawing.Printing.Duplex.Horizontal;

PrintDocument pd = new PrintDocument();
pd.DefaultPageSettings.Landscape= blnLandscape;
pd.DefaultPageSettings.PrinterSettings.Duplex=System.Drawing.Printing.Duplex.Horizontal;
pd.PrinterSettings = printerSettings;

pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
pd.Print();

//******************************************
 
P

Peter Duniho

I’m not sure how to feed PCL commands (i.e. “Ec&l1Sâ€) thru the
PrinterSettings() function, but we have been successfully using the
PrinterSetting() properties and methods to successfully call on most of
the printer’s properties.

Our understanding was that by using the correct combination of
“.Landscapeâ€
and “.Duplex.Horizontal†properties, we would be able to accomplish the
“flip
pages upâ€, in which the report is printed in landscape mode, printed on
both
sides, and printed in a notebook layout (back side flipped up).

We can’t get this to work properly. We can get the report to
programmatically print landscape and duplex, but the call to flip pages
up is NOT working.
[...]

The first line of your post seems to be a non-sequitur. That said, I'm
not aware of anything in .NET that is similar to the native Windows API
function Escape(), which is what you'd use to send PCL commands directly
to a printer that supports PCL. You would have to get the HDC from the
Graphics object, and use p/invoke to call the non-managed Escape() method.

As far as the question of the duplex settings go, what printer are you
using? Are you sure that it supports that combination of settings? Is
the user able to configure the settings using the print options (page
setup) dialog? And perhaps a silly question, but are you sure you're not
getting the output you want?

On that last point, I mean I'm not really clear on what it is exactly you
want from the printer. A printer with built-in duplexing could take
advantage of the setting (but not all do), but for lots of printers there
is no built-in duplexing. The user needs to remove the printed pages and
feed them back in, and it's up to the user to feed the back back in with
the correct orientation to accomplish the binding edge they want.

Like I said, maybe a silly question, but your post isn't very clear about
exactly what's not working or what printer you're trying to do this with.

Pete
 
G

Guest

Peter,
Thanks for the reply.

I have a C# application that allows users to send SQL Reporting Services
reports directly to the printer without having to access Reporting Services.

Some of these reports require two-sided printing, some one-sided printing.
Some reports require the "Flip Pages Up" feature of one our HP printers.
This is duplex, landscape, longedge binding.
I have been able to automate every feature of all my reports by utilizing
the properties and methods of PrinterSettings() with the exception of the
"Flip Pages Up" feature.
I have found an escape sequence that I believe gives me what I want, but I
don't know how to incorporate it into the PrinterSettings() methodology.
I'd appreciate any help.
Thanks.


Peter Duniho said:
I’m not sure how to feed PCL commands (i.e. “Ec&l1Sâ€) thru the
PrinterSettings() function, but we have been successfully using the
PrinterSetting() properties and methods to successfully call on most of
the printer’s properties.

Our understanding was that by using the correct combination of
“.Landscapeâ€
and “.Duplex.Horizontal†properties, we would be able to accomplish the
“flip
pages upâ€, in which the report is printed in landscape mode, printed on
both
sides, and printed in a notebook layout (back side flipped up).

We can’t get this to work properly. We can get the report to
programmatically print landscape and duplex, but the call to flip pages
up is NOT working.
[...]

The first line of your post seems to be a non-sequitur. That said, I'm
not aware of anything in .NET that is similar to the native Windows API
function Escape(), which is what you'd use to send PCL commands directly
to a printer that supports PCL. You would have to get the HDC from the
Graphics object, and use p/invoke to call the non-managed Escape() method.

As far as the question of the duplex settings go, what printer are you
using? Are you sure that it supports that combination of settings? Is
the user able to configure the settings using the print options (page
setup) dialog? And perhaps a silly question, but are you sure you're not
getting the output you want?

On that last point, I mean I'm not really clear on what it is exactly you
want from the printer. A printer with built-in duplexing could take
advantage of the setting (but not all do), but for lots of printers there
is no built-in duplexing. The user needs to remove the printed pages and
feed them back in, and it's up to the user to feed the back back in with
the correct orientation to accomplish the binding edge they want.

Like I said, maybe a silly question, but your post isn't very clear about
exactly what's not working or what printer you're trying to do this with.

Pete
 

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