PdfImage image = new PdfBitmap(PathToImage);
//PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Tahoma", 10f, FontStyle.Bold), false);
// PdfSolidBrush brush = new PdfSolidBrush(Color.DarkBlue);
float ftImageWidth;
float ftImageHeight;
float ftPageWidth;
float ftPageHeight;
float.TryParse(image.Width.ToString(), out ftImageWidth);
float.TryParse(image.Height.ToString(), out ftImageHeight);
ftPageWidth = page.Graphics.ClientSize.Width;
ftPageHeight = page.Graphics.ClientSize.Height;
float myWidth = image.Width;
float myHeight = image.Height;
float shrinkFactor;
float temp;
if (myWidth > ftPageWidth)
{
shrinkFactor = myWidth / ftPageWidth;
myWidth = ftPageWidth;
myHeight = myHeight / shrinkFactor;
}
if (myHeight > ftPageHeight)
{
shrinkFactor = myHeight / ftPageHeight;
myHeight = ftPageHeight;
myWidth = myWidth / shrinkFactor;
}
g.DrawImage(image, (ftPageWidth - myWidth)/2, (ftPageHeight - myHeight)/2, myWidth, myHeight);