473,386 Members | 1,644 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,386 software developers and data experts.

Printing and setting Page Sizes

Hey folks,

I'm trying to print from a c# windows application using
System.Drawing.Printing. My problem is that it doesn't matter what I put in
for papersize, it always ignores what I tell it and always prints out the
same thing. Landscape works though. Does anyone see any problems with this
code?

printDoc.PrinterSettings.PrinterName = configSettings.labelPrinterName;
printDoc.DefaultPageSettings.Landscape = true;
printDoc.DefaultPageSettings.PaperSize.Width = 350;
printDoc.DefaultPageSettings.PaperSize.Height = 700;
printDoc.PrintPage += new PrintPageEventHandler(printDoc_PrintPage);
printDoc.Print();
:
:
private void printDoc_PrintPage(Object sender, PrintPageEventArgs e)
{
e.PageSettings.PaperSize.Width = 350;
e.PageSettings.PaperSize.Height = 700;
e.PageSettings.Landscape = true;

Font printFont = new Font("Arial", 10, System.Drawing.FontStyle.Bold);
e.Graphics.DrawString(strTextToPrint, printFont, Brushes.Black, 0, 0);
}
Nov 16 '05 #1
2 13574
Hi John,

I replied to your post in the drawing group. Did you try to change
Margins instead of PaperSize?

--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #2
Hi Morten,

I can't see my post in the drawing group for some reason, so I didn't see
your other response. Sorry.

As far as the margins go, I did try adding them to the code I posted and set
them all to 0 but it produced the same results.

I'm printing to a special label printer, and right now the text outputted is
way too far over to the right. If you print from notepad it prints
correctly if you set the papersize width to 3.5" and height to 7.0" and
print Landscape. My landscape works, but it doesn't matter what I put for
papersize, it always prints out the same.

Thx for the help!
"Morten Wennevik" <Mo************@hotmail.com> wrote in message
news:opsicjkeqyklbvpo@pbn_computer...
Hi John,

I replied to your post in the drawing group. Did you try to change
Margins instead of PaperSize?

--
Happy Coding!
Morten Wennevik [C# MVP]

Nov 16 '05 #3

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

Similar topics

4
by: Jody Gelowitz | last post by:
I am having a problem with printing selected pages. Actually, the problem isn't with printing selected pages as it is more to do with having blank pages print for those pages that have not been...
0
by: DotNetDummy | last post by:
Hi all, I am trying to set the printing setting e.g duplex mode etc. on a default printer when I.E object started printing a particular html doc. Here's the partial code, any help would be...
28
by: reneecccwest | last post by:
hello, how can I remove IE headers and footers when I print a page? I'd like to use a code to remove them, not thru the IE page setup. s/RC
6
by: Biguana | last post by:
Hi, Just wondering if anyone can help here. We have a site where most of the site opens in a window with no toolbars or menubar: window.open('mypage.aspx','self','toolbar=0, menubar=0, etc,...
3
by: Tapi | last post by:
I would like to know the page sizes of certain .asp ansd .aspx pages on the Internet. What I am doing now is go to the web site, right-click the mouse and click on Properties. Some pages give...
1
by: John | last post by:
Hi I am printing invoices on an oki dot matrix printer using continuous stationery. The problem is that the stationery page height is only 8" which does not match with any of the page size...
2
by: chyogesh76 | last post by:
i created a report in crystal report i am using it in vb6.0. while printing through vb it was printing in a4 size but i want make it custom size(small size 5'' X10"). how can i do. any one please...
2
by: rlntemp-gng | last post by:
Re: Access 2003 My client has a printer that can print single-sided or double-sided. The default settings for this printer in Windows is double-sided printing for the bulk of their work. ...
4
by: drsvvr | last post by:
Hi everyone!, Please help me to do the setting page layout in data report. i dont think the default setting in data report is portrait, my project is need a landscape report, but i dont know how...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.