473,406 Members | 2,467 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,406 software developers and data experts.

PrinterSettings() in csharp

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=blnL andscape;
printerSettings.Duplex = System.Drawing.Printing.Duplex.Horizontal;

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

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

//******************************************
May 23 '07 #1
2 5404
On Wed, 23 May 2007 09:12:05 -0700, David
<Da***@discussions.microsoft.comwrote:
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
May 23 '07 #2
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" wrote:
On Wed, 23 May 2007 09:12:05 -0700, David
<Da***@discussions.microsoft.comwrote:
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
Jul 31 '07 #3

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

Similar topics

3
by: RBisch | last post by:
I am finding that some of the properties off of the PrinterSettings object are misleading For example, When I test the CanDuplex on a printer I know duplexes, the property is false. Another one...
3
by: Steve Hanna | last post by:
I am having problems using the Printer Dialog to set PrinterSettings, specifically the landscape property of the DefaultPageSettings. Here's the code: <code> Private Sub GetPrinter(ByRef...
1
by: Richard Golebiowski | last post by:
I have been trying to figure this out for quite some time and cannot find any examples in VB.Net or in VB that work correctly. I am working on an application where I want the user to be able to...
3
by: Jochen Kalmbach | last post by:
Hello, if an PrinterSettings-Instance is not set-up correctly (for example just by using the default-constructor), then the "ToString()"_method will throw an exception! Unhandled...
2
by: Robert Hooker | last post by:
Hi, I'm curious to know if I'm doing something wrong here, or if this is just mind-numbingly slow for a reason. In a simple WindowsFormsApplication: public Form1() { // Required for...
1
by: Sachin | last post by:
I have multiple printer drivers installed (e.g. EPSON, RICOH, CANNON) on my computer. Is there any way to check/get the PrinterSettings of any of them using Printer Name? i.e. if I want to check...
0
by: trint | last post by:
try { // Wait for the report to completely render. if(m_numberOfPages < 1) return false; PrinterSettings printerSettings = new PrinterSettings(); printerSettings.MaximumPage = m_numberOfPages;...
3
by: trint | last post by:
Can someone help me to get this code to work...I'm unsure what the 'printDoc' variable is supposed to be? // Add list of paper sources found on the printer to the combo box. // The DisplayMember...
2
by: Tessa | last post by:
Hi, We have a .net web application, and are trying to use PrinterSettings.InstalledPrinters to list the printers installed on the webserver. (Windows 2003 server R2, IIS 6, .net framework 2.0.)...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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 projectplanning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.