0

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);
Community
  • 1
  • 1
Bryan
  • 8,488
  • 14
  • 52
  • 78

1 Answers1

1

Have you tried scaling down before adding it to "Chunk"?

bazz
  • 613
  • 4
  • 10