Thanks for you reply. The only reason i was loading Image into System.Drawing.Image or Bitmap class is just to get dimensions of the image so i can compare it with the page size and set the FixWidth & FixHeight accordingly.
But according to your post earlier
If you implement the following logic to place the image inside Section object, where we have already specified the MarginInfo for Section element, the image will automatically be resized to fit inside the PDF page (either its Smaller or Larger than page dimensions).
If aspose API can fit the image into section without me programmatically calculating the dimensions then i would prefer that.However, I could not find the following logic as you mentioned.
Hi Laxmikant,
Thanks for sharing further details and sorry for the delayed response.
In my earlier attempt, I tried using some sample images where the files were properly being adjusted inside the Section element however I have observed that the images with very large Heigh/Width dimensions, the images are flowing out of the page Right and Bottom margin (because all the paragraphs in side PDF structure are placed in Flow layout i.e. Top-Left to Bottom-Right). I think the better and recommended procedure is to first get the image dimensions and set the Page Height/Width information based over this information OR you can set the image dimensions based over page dimensions.
Furthermore concerning to your query on"ImageHeight, ImageWidth, FixHeight and FixWidth in Pixel??’’ Please note that Image Height and Width properties use Point as basic unit, where 1 inch = 72 points and 1 cm = 1/2.54 inch = 0.3937 inch = 28.3 points.
Please note that the conversion from Point to Pixel depends on dpi (dots per inch) property of an image. For example, if dpi for some image equals 96 (that means it has 96 pixels for each inch), and it has 100 points height, its height in pixels is 100 / 72 * 96 = 133.3. General formula is:
Pixels = Points / 72 * dpi.
Aspose.Generator.Pdf doesn’t contain method to convert points to pixels, so you need to programatically convert the values.
In the event of any further query, please feel free to contact. We are sorry for the confusion and inconvenience.
I would prefer to setup FixWidth and FixHeight based on page size.
I’ll be comparing image’s width & height against PageSetup.PageWidth & PageSetup.Height, what is the unit of measurement for PageWidth, PageHeight and also Margin?
Laksh: I would prefer to setup FixWidth and FixHeight based on page size.
I’ll be comparing image’s width & height against PageSetup.PageWidth & PageSetup.PageHeight, what is the unit of measurement for PageWidth, PageHeight and also Margin?
Hi Laxmikant,
Page Width and PageHeight also use Point as measurement unit. In the event of any further query, please feel free to contact.