bool ModifySize = false;<o:p></o:p>
var p = new Pdf();
var sect1 = p.Sections.Add();
// Create a BitMap object
// Set margins so image will fit, etc.
sect1.PageInfo.Margin.Top = 5;
sect1.PageInfo.Margin.Bottom = 5;
sect1.PageInfo.Margin.Left = 5;
sect1.PageInfo.Margin.Right = 5;
TypeConverter tc = TypeDescriptor.GetConverter(typeof(Bitmap));
Bitmap image = new Bitmap("c:/pdftest/Sample1_Tiff_Version+.tif");
var imageht = new
Aspose.Pdf.Generator.Image(sect1);
imageht.ImageInfo.ImageFileType = ImageFileType.Tiff;
imageht.ImageInfo.TiffFrame = -1;
Console.WriteLine("Image
Height--" + image.Height);
Console.WriteLine("Page
Height" + sect1.PageInfo.PageHeight);
Console.WriteLine("Image
Width--" + image.Width);
Console.WriteLine("Page
Width" + sect1.PageInfo.PageWidth);
//Add image object into the Paragraphs
collection of the sect1tion
sect1.Paragraphs.Add(imageht);
int imgHt = (int)sect1.PageInfo.PageHeight;
int imgWth = (int)sect1.PageInfo.PageWidth;
if (image.Width > sect1.PageInfo.PageWidth)
{
Console.WriteLine("Image
width is greater than Page width");
sect1.IsLandscape = true;
}
else {
Console.WriteLine("Image
Width is less than Page width");
sect1.IsLandscape = false;
}
imageht.ImageInfo.SystemImage = image;
p.Save("c:/pdftest/Sample1_Tiff_Version+.pdf");
I have not changed the width and height of input image and have placed it in its original dimensions. In case you still face the same problem, please feel free to contact.