Reputation: 8697
The code exactly shows how i retrieve my image from the database and insert into the pdf. However my picture isn't sized as the way i wanted it to be. How do i resize them? I tried using ScaleToFit and scaleabsolute but it doesn't work :/
I got the method scale absolute from here
phrase.Add(new Chunk("Image1 :\u00a0", normalFont));
Byte[] bytes1 = (Byte[])dr[8];
iTextSharp.text.Image image1 = iTextSharp.text.Image.GetInstance(bytes1);
Chunk imageChunk1 = new Chunk(image1, 0, 0);
image1.ScaleToFit(50f, 50f);
//image1.ScaleAbsolute(159f, 159f);
phrase.Add(imageChunk1);
phrase.Add(new Chunk("Image2 :\u00a0", normalFont));
Byte[] bytes2 = (Byte[])dr[9];
iTextSharp.text.Image image2 = iTextSharp.text.Image.GetInstance(bytes2);
Chunk imageChunk2 = new Chunk(image2, 0, 0);
image2.ScaleToFit(50f, 50f);
//image2.ScaleAbsolute(159f, 159f);
phrase.Add(imageChunk2);
Upvotes: 0
Views: 546