Solved

c# printer settings problems

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Media Player 2 26
Problem!!! 8 33
Sending receiving text messages in vb.net 15 32
VB.NET 2008 - SQL Timeout 9 23
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.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

786 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