我在单独的单元格中创建了一个包含6个图像的单个pdf页面,即使我在服务器端设置的图像高度和宽度与ScaleToFit完全相同,但是在pdf页面上的图像大小也不相同.
反正有没有让所有图像完全相同的尺寸?
- PdfPTable table = new PdfPTable(3);
- table.HorizontalAlignment = Element.ALIGN_CENTER;
- table.WidthPercentage = 100;
- table.TotalWidth = 698.5f;
- table.LockedWidth = true;
- table.SetWidths(new float [] {1,1,1});
- iTextSharp.text.Image img1 = iTextSharp.text.Image.GetInstance("C:\\Users\\DaNet\\Downloads\\image.jpg");
- img1.Alignment = iTextSharp.text.Image.ALIGN_CENTER;
- img1.ScaleToFit(120f,155.25f);
- iTextSharp.text.pdf.PdfPCell imgCell1 = new iTextSharp.text.pdf.PdfPCell(img1);
- imgCell1.HorizontalAlignment = Element.ALIGN_CENTER;
- imgCell1.BackgroundColor = new BaseColor(255,255,255);
- imgCell1.Border = iTextSharp.text.Rectangle.NO_BORDER;
- table.AddCell(imgCell1);