C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » .NET Framework »

How to set your printing paper size through program?


Posted Date: 22 Feb 2004    Resource Type: Articles    Category: .NET Framework
Author: Shashijeevan M.P.Member Level: Silver    
Rating: 1 out of 5Points: 5



The following code instantiates a PrintDocument and then enumerates all the supported Paper sizes and selects the appropriate PaperSize.

This PaperSize is assigned to the DefaultPageSettings object of the PrintDocument.

If no appropriate PaperSize is found (i.e., PaperSize==nul) then the Printer's default setting that is configured from the control panel is used.

I have skipped the actual printing logic.



PrintDocument pd = new PrintDocument();

PaperSize p=null;

foreach(PaperSize ps in pd.PrinterSettings.PaperSizes)
{
if(ps.PaperName.Equals("A3"))
p = ps;
}

pd.DefaultPageSettings.PaperSize = p;

//Register PrintPageEventHandler

pd.Print();




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: How to get your default printer name?
Previous Resource: C# Tip on Keywords
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use