Solved

c# printer settings problems

Posted on 2008-10-15
5
1,494 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

740 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