Last post Sep 01, 2017 11:23 PM by jzero
May 11, 2017 03:00 PM|sxlin|LINK
I need to create a certificate as an image, and the quality of printed out as A4 size is good, ideally the image too.
Specifically, I need to load an existing certificate template which contains a badge, a frame, and a signature (please see below regarding the best format of the template); then write text onto the loaded image, save it, and let user download it, and print
My questions is about the quality of the image, especially when it is printed out.
1 Currently, the existing template is PDF file. What file format should I use, pdf vs image (.png, bmp, .jpg), so the print out quality is good?
2 If the template is image files, What must the dimension of the template, and DPI be for an A4 size print out.
3. Will using lines A, B and C below affect the print out quality?
This is an ASP.NET web forms project.
Below is the prototype:
static string imageBaseFilePath = @"D:\Dev\MyLab\ConsoleApplication1\CertificateGenerator\";
static string userName = "Stephen Jonathon";
static string testName = "Microsoft C# Deveoper Practice Test";
static string testDate = "Thursday, November 10, 2016";
static string score = "Score 33 / 33";
static void Main(string args)
string imageFilePath = imageBaseFilePath + "template.PNG"; //please question 1 above
Bitmap bitmap = (Bitmap)Image.FromFile(imageFilePath);
const int dotsPerInch = 600; // define the quality in DPI
using (Graphics graphics = Graphics.FromImage(bitmap))
//graphics.SmoothingMode = SmoothingMode.AntiAlias; //line A
//graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; //line B
//graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; //line C
graphics.DrawString(userName, new Font("Times-Roman", 0.1f, FontStyle.Regular, GraphicsUnit.Inch), Brushes.Black, 350f, 350f);
graphics.DrawString(testName, new Font("Times-Roman", 0.06f, FontStyle.Regular, GraphicsUnit.Inch), Brushes.Black, 180f, 420f);
graphics.DrawString(testDate, new Font("Times-Roman", 0.05f, FontStyle.Regular, GraphicsUnit.Inch), Brushes.Black, 350f, 490f);
graphics.DrawString(score, new Font("Times-Roman", 0.06f, FontStyle.Regular, GraphicsUnit.Inch), Brushes.Black, 350f, 550f);
string fileName = "result3600.PNG";
bitmap.Save(imageBaseFilePath + fileName);
Sep 01, 2017 11:23 PM|jzero|LINK
In old times, when scanners was becoming in market, and computers was not so strong, there was a rule to follow.
Just scan as half DPI of your printer DPI. You have a good result and will not exhaust your memory.
From my point of view, you can lower your 600DPI by half.
Take a look here http://www.scantips.com/calc.html