【发布时间】:2014-11-20 08:27:58
【问题描述】:
也许有人现在如何 StrikeThrough PDF 表单中的数据?
我试过了
AcroFields pdfFromFields = pdfStamper.AcroFields;
pdfFormFields.SetFieldProperty(fieldname, "sthhere", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 12 , Font.STRIKETHRU),null);
pdfFormFields.SetField(fieldname, fieldvalue);
但出现错误 “无法将 iTextSharp.text.Font 类型的对象转换为 iTextSharp.text.pdf.BaseFont 类型” 感谢您的帮助。
我用过
Chunk c1 = new Chunk ("insideText", FonctFactory.GetFont(FonctFactory.TIMES_ROMAN,12,Font.STRIKETHRU));
AcroFields form = stamper.getAcroFields();
Rectangle rect = form.getFieldPositions("fieldName").ElementAt(0).position;
ColumnText ct = new ColumnText(canvas);
ct.SetSimpleColumn(rect);
ct.AddElement(c1);
ct.Go();
并且添加的文本被放置在低于中间字段位置并且太左的位置。怎么太中心化了?
【问题讨论】:
-
使用包含被划过的字符的字体。
标签: c# pdf pdf-generation itextsharp strikethrough