We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

BMP to PDF is mirroring my image

The below code will put out the bmp in a pdf but the image appears to be rotated. Does anybody have a solution for this?


Thanks in advance
Kieran

        public static MemoryStream ImageToPdf(byte[] data, ImageFileType imageFileType)
        {
var pdfImg = new Pdf();
var secImg = pdfImg.Sections.Add();
var imgImage = new Image(secImg);
secImg.Paragraphs.Add(imgImage);
imgImage.ImageInfo.ImageFileType = imageFileType;
var imgMemoryStream = new MemoryStream(data);
imgImage.ImageInfo.ImageStream = imgMemoryStream;
imgImage.ImageInfo.IsAllFramesInNewPage = true;
var img = System.Drawing.Image.FromStream(imgMemoryStream);
secImg.IsLandscape = img.Width > img.Height;
if (img.Width > secImg.PageInfo.PageWidth)
{
imgImage.ImageInfo.FixWidth = secImg.PageInfo.PageWidth - secImg.PageInfo.Margin.Left - secImg.PageInfo.Margin.Right;
imgImage.ImageInfo.FixHeight = (float)(imgImage.ImageInfo.FixWidth * ((double)img.Height / img.Width));
}
var pdfMemorySteam = new MemoryStream();
pdfImg.Save(pdfMemorySteam);
return pdfMemorySteam;
}

Hi Kieran,


Thanks for your inquiry. I have tested the scenario with a sample BMP file but I am afraid I am unable to replicate the issue. Please share your sample image here, so we will test the scenario at our end and will provide you more information accordingly.

We are sorry for the inconvenience caused.

Best Regards,