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
Raja Priya Meganathan
NA
194
7.3k
Default printer setting is changed in windows.
Mar 3 2021 12:50 PM
Hello Team,
The system default print setting will be changing when my customer has used to print a document in my application. Attached the screenshot for the printer setting default screen.
I have used the below code to print my documents in my project, I need to use the below code and print my documents without change the system default printer setting.
In my project, I will print the image in the below code. Any have an idea please share how to print without change the system default print setting.
PrintDocument pd =
new
PrintDocument();
PrintController printController =
new
StandardPrintController();
pd.PrintController = printController;
pd.PrinterSettings.PrinterName = LabelPrinter.Text.ToString();
//Printer Name
pd.PrinterSettings.Copies = Convert.ToInt16(printqty);
pd.DefaultPageSettings.Landscape =
false
;
pd.DefaultPageSettings.Margins =
new
Margins(0, 0, , 0);
pd.PrinterSettings.DefaultPageSettings.Margins =
new
Margins(0, 0, 0, 0);
pd.PrintPage += (sndr, args) =>
{
System.Drawing.Image i = System.Drawing.Image.FromFile(FileName);
//image
//Adjust the size of the image to the page to print the full image without losing any part of the image.
System.Drawing.Rectangle m = args.MarginBounds;
//Logic below maintains the Aspect Ratio.
if
((
double
)i.Width / (
double
)i.Height > (
double
)m.Width / (
double
)m.Height)
// image is wider
{
m.Height = (
int
)((
double
)i.Height / (
double
)i.Width * (
double
)m.Width);
}
else
{
m.Width = (
int
)((
double
)i.Width / (
double
)i.Height * (
double
)m.Height);
}
//Calculating optimal orientation.
pd.DefaultPageSettings.Landscape = m.Width > m.Height;
pd.DefaultPageSettings.Landscape =
false
;
args.Graphics.DrawImage(i, m);
};
pd.Print();
Reply
Answers (
6
)
Trying to send the message to my Gmail account.
How to create GraphServiceClient?