Solved

c# printer settings problems

Posted on 2008-10-15
5
1,486 Views
Last Modified: 2013-12-17
Hi guys,
i've developed an application to print a set of images/strings, i need to be able to print to a number of different paper sizes including A6...however, every time i just goes to A4.
what am i doing wrong?
0
Comment
Question by:zell71
  • 2
  • 2
5 Comments
 
LVL 15

Assisted Solution

by:angus_young_acdc
angus_young_acdc earned 200 total points
ID: 22719350
0
 
LVL 6

Author Comment

by:zell71
ID: 22719407
thanks angus_young_acdc
hmm these links (1 & 2) do mention how to set up the print settings, how i'm a little confused on how to execute the paper size.
for example, ideally i would have a combo box with A4, A6...selecting either and hitting print would then perform the print to the paper size.
link 2 seems close, but as i said..not sure how i actually execute the selected paper size.
0
 
LVL 15

Expert Comment

by:angus_young_acdc
ID: 22719430
Within link one:
    e.Graphics.MeasureString(_text.Substring(RemoveZeros(curChar)), PrinterFont, new SizeF(printWidth, printHeight), format, out chars, out lines);  
 
    //Print the page  
    e.Graphics.DrawString(_text.Substring(RemoveZeros(curChar)), PrinterFont, Brushes.Black, printArea, format);  

And your printWidth and printHeight would be set as whatever the size of the combo box was.  EG the pseudo code:
if ComboBox value == A4
printHeight = 200;
printWidth = 75;
0
 
LVL 6

Author Comment

by:zell71
ID: 22719509
erm doesn't this just set the print area not the papersize?
 
0
 
LVL 26

Accepted Solution

by:
Anurag Thakur earned 300 total points
ID: 22720583
use the code like this
the following line configures page size to A4 similarly you can set it to something else
printDocument.DefaultPageSettings.PaperSize= new System.Drawing.Printing.PaperSize("PaperA4",826,1169);
this i found from following link
http://www.tek-tips.com/viewthread.cfm?qid=357725


to find what all page sizes are supported by the printer you can refer to the following link
http://www.java2s.com/Tutorial/CSharp/0280__Development/PrintersettingsDisplaythelistofvalidpapersizes.htm
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now