This one is a little more cleaned up :-)PdfImage image = new PdfBitmap(PathToImage);float PageWidth = page.Graphics.ClientSize.Width;float PageHeight = page.Graphics.ClientSize.Height;float myWidth = image.Width;float myHeight = image.Height;float shrinkFactor;if (myWidth > PageWidth){shrinkFactor = myWidth / PageWidth;myWidth = PageWidth;myHeight = myHeight / shrinkFactor;}if (myHeight > PageHeight){shrinkFactor = myHeight / PageHeight;myHeight = PageHeight;myWidth = myWidth / shrinkFactor;}float XPosition = (PageWidth - myWidth) / 2;float YPosition = (PageHeight - myHeight) / 2;g.DrawImage(image, XPosition, YPosition, myWidth, myHeight);
Is it possible to resize/scale an image using one of the PdfImage.Draw() overloads? (or resize the image before drawing it, without relying on GDI+ APIs in System.Drawing)