Solved

c# printer settings problems

Posted on 2008-10-15
5
1,495 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
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…

739 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