Free Support Forum -

Page rotation or image rotation


Based on the size of the image (landscape or portrait) either the page need to be flipped or the image need to post accordingly i.e.
how to make the image posted based on its size (if the dimentions are biger than the page size )
or how to roatate the image(landscape) if the page layout for the document is in portrait.


Hi Phanindra,

Thanks for your inquiry. Please check following documentation link for converting Image to PDF. It sets PDF page dimensions as per image dimensions. However if you want set image as per Page dimensions then do not set page properties but image FixHeight and FixWidth as following. Hopefully it will help you to accomplish the requirements.

// Set margins so image will fit, etc.

//page.PageInfo.Margin.Bottom = 0;

//page.PageInfo.Margin.Top = 0;

//page.PageInfo.Margin.Left = 0;

//page.PageInfo.Margin.Right = 0;

//page.CropBox = new Aspose.Pdf.Rectangle(0, 0, b.Width, b.Height);

// Create an image object

Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();

image1.FixHeight = page.Rect.Height;

image1.FixWidth = page.Rect.Width;



Please feel free to contact us for any further assistance.

Best Regards,

thank you Tilal Ahmed will try as suggested