TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
srivalli.chavali
NA
13
0
Customizing Printing tray using C#
Dec 3 2004 4:54 PM
Hi, I have a C# form that containsa button, which when clicked, prints a particular document on my machine. I have to customize the printing options. I was successful in customizing font, margins etc. But I'm having issues with customizing the input tray. I want to print that document always from the Tray1 of my printer. But if you access the "Kind" property of each element of the collection, "printDoc.PrinterSettings.PaperSources", it returns only "FormSource" and "Custom" as the values. Now, How can I set it to print to "Tray1" here? Following is my code.. ---------------------------------- private void Button1_Click(object sender, System.EventArgs e) { sr = new StreamReader ("a.txt"); f= new Font("Courier New", 14); PrintDocument printDoc = new PrintDocument(); PaperSource pkSource=null; for (int i = 0; i < printDoc.PrinterSettings.PaperSources.Count; i++) { PaperSource item; item= printDoc.PrinterSettings.PaperSources[i]; pkSource=item; printDoc.DefaultPageSettings.PaperSource =pkSource; printDoc.PrintPage += new PrintPageEventHandler(pqr); printDoc.Print(); } } void pqr(object o, PrintPageEventArgs e) { float lpp = e.MarginBounds.Height / f.GetHeight(e.Graphics) ; int c = 0 ; String s=null; while (c < lpp && ((s=sr.ReadLine()) != null)) { float y = e.MarginBounds.Top + (c * f.GetHeight(e.Graphics)); e.Graphics.DrawString (s, f, Brushes.Black, e.MarginBounds.Left, y); c++; } if (s != null) e.HasMorePages = true ; else e.HasMorePages = false ; } --------------------------------------------- Any help is greatly appreciated. Thanks, Srivalli.
Reply
Answers (
0
)
How to create File Explorer Tree View Control with check boxes
Custom Control Property (list)