Need to set size of image in Aspose PDF


When we add a image or logo to a pdf file using ASPOSE PDF, i want to set the height & width of image to 15mm & 65mm.

Can you please help me with code to set to this height & width

Also there is a fixheight property on image class what units does it use (mm or cm or inches or pixels)

image.png (16.6 KB)



The unit of FixHeight and FixWidth properties is the point (72 pints = 1 inch, 1 inch = 25.4 mm). This is the code example to add an image in the PDF document:


string dataDir = @"C:\Pdf\test627\";
// Instantiate Document object
Document doc = new Document();
// add page to pages collection of PDF file
Aspose.Pdf.Page page = doc.Pages.Add();
// Create an image instance
Aspose.Pdf.Image img = new Aspose.Pdf.Image();
img.FixWidth = 42.51; // 15mm = (15/25.4*72) points
img.FixHeight = 600;
// Set image type as SVG
img.FileType = Aspose.Pdf.ImageFileType.Unknown;
// Path for source file
img.File = dataDir + "Example.png";
//Set page properties
page.PageInfo.Width = 800;
page.PageInfo.Height = 800;
// save resultant PDF file
doc.Save(dataDir + "Test.pdf");

Thanks Imran!!!

Hi Imran,

If you speak with the team that produces the documentaton for the Image class so they add the unitis for FixWidth and FixHeight will save us alot of time searching and wondering …

Here you explain it great - but the documentation is lacking.
Looking at that page i do not receive any helpful information…

They can just copy paste your example and we as customers will be very happy! :slight_smile:


We apologize for the inconvenience faced while searching required information in documentation. We will definitely consider your suggestion to improve API documentation accordingly.