On the public/images
folder in my server I have uploaded the jpg image
with 2048x1536 pixel and 290 kb.
I have memorized in MySQL table database on the field Pic
this link : http://mywebserver.xxx/aspx/public/images/IMG0006A.jpg
I need print this image on pdf file using iTextSharp library and resized this image because its original file size are off page pdf.
I have find this similar question and I have tried the suggestion without success because in the output the jpg image printed on pdf file is always out page.
How to do resolve this ?
Can you help me?
Thank you in advance, my code below.
.aspx markup
<table border="1">
<tr>
<td colspan="2">
<label for="Pic">
Pic<br />
</label>
<asp:Image ID="Pic" runat="server" /></td>
</tr>
</table>
.cs code-behind
if (!String.IsNullOrEmpty(reader["Pic"].ToString()))
{
lbPic.ImageUrl = reader["Pic"].ToString();
iTextSharp.text.pdf.PdfPCell imgCell1 = new iTextSharp.text.pdf.PdfPCell();
iTextSharp.text.Image img1 = iTextSharp.text.Image.GetInstance(Server.MapPath("\\public\\images\\IMG0006A.jpg"));
imgCell1.AddElement(new Chunk(img1, 0, 0));
img1.ScaleToFit(120f, 155.25f);
img1.ScaleAbsolute(120f, 155.25f);
}