Hello,
Hi Chad,
string inFile =
myDir + “TestImage.bmp”;<o:p></o:p>
MemoryStream ms = new MemoryStream();
Document doc = new Document();
Page page = doc.Pages.Add();
FileStream fs = new FileStream(inFile, FileMode.Open, FileAccess.Read);
byte[] tmpBytes = new byte[fs.Length];
fs.Read(tmpBytes, 0, Convert.ToInt32(fs.Length));
MemoryStream mystream = new MemoryStream(tmpBytes);
// 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.PageInfo.Height = Aspose.Pdf.PageSize.A4.Height;
page.PageInfo.Width = Aspose.Pdf.PageSize.A4.Width;
//Create an image object
Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();
//Add the image into paragraphs collection of the section
page.Paragraphs.Add(image1);
//Set the ImageStream to a MemoryStream object
image1.ImageStream = mystream;
doc.Save(ms);
Please feel free to contact us for any further assistance.
Best Regards,
Thank you for the answer.
Hi Chad,