作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 itextsharp 创建 Pdf。我添加了一张包含两列的表格,其中一列包含文本和其他图像。我想要恒定的图像大小
for (int i = 0; i < visitInfo.VisitsiteComplience.Count; ++i)
{
cellprop.Colspan = 1;
cellprop.Pharse = visitInfo.VisitsiteComplience[i].Compliencedescription;
cellprop.BaseColor = null;
table.AddCell(AddCelltoTable(cellprop));
yesicon.ScaleAbsolute(35f, 35f);
noicon.ScaleAbsolute(35f, 35f);
if (visitInfo.VisitsiteComplience[i].Status == "1")
{
statuscell.AddElement(new Chunk(noicon, 0, 0));
}
else
{
// statuscell.AddElement(new Chunk(noicon, 0, 0));
}
statuscell.FixedHeight = 10;
//headerLeftCell.Border = PdfPCell.NO_BORDER;
table.AddCell(statuscell);
}
for (int i = 0; i < visitInfo.VisitsiteComplience.Count; ++i)
{
cellprop.Colspan = 1;
cellprop.Pharse = visitInfo.VisitsiteComplience[i].Compliencedescription;
cellprop.BaseColor = null;
table.AddCell(AddCelltoTable(cellprop));
yesicon.ScaleAbsolute(35f, 35f);
noicon.ScaleAbsolute(35f, 35f);
if (visitInfo.VisitsiteComplience[i].Status == "1")
{
statuscell.AddElement(new Chunk(noicon, 0, 0));
}
else
{
// statuscell.AddElement(new Chunk(noicon, 0, 0));
}
//headerLeftCell.Border = PdfPCell.NO_BORDER;
table.AddCell(statuscell);
}
最佳答案
我认为您自己缩放图像是这样的:noicon.ScaleAbsolute(35f, 35f);
这也让我感到困惑,为什么要将图像包装在 Chunk
中.您可以创建一个 PdfPCell
这需要一个 Image
作为参数以及 Bool
to 定义 iText 是否应该缩放 Image
.参见本书第 109 页 iText in Action (其中我是作者)并查看 chapter 4 的 XMen 示例.
关于插入 PdfCell 时图像会调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15741980/
我正在尝试使用 itextsharp 创建 Pdf。我添加了一张包含两列的表格,其中一列包含文本和其他图像。我想要恒定的图像大小 如果另一个单元格中的文本增加并且其他单元格中的图像大小不同,我的图像会
我将 itextsharp 与 aspmvc 项目结合使用来创建我的一些页面的 PDF 版本。我有一个非常基本的解析器,它采用简单的 html(加上一些单独提供的样式信息)并创建一个 pdf。当我的解
我将 itextsharp 与 aspmvc 项目结合使用来创建我的一些页面的 PDF 版本。我有一个非常基本的解析器,它采用简单的 html(加上一些单独提供的样式信息)并创建一个 pdf。当我的解
我是一名优秀的程序员,十分优秀!