【发布时间】:2019-09-05 19:46:44
【问题描述】:
我有一个我在 Adobe Acrobat Pro 2017 中创建/编辑的 PDF。目标是在我们的网站上动态填写它。它是成功的,除了一个部分;其中一个表单字段不会按预期换行。
var TheForm = PdfAcroForm.GetAcroForm(TheDocument, true);
var Fields = TheForm.GetFormFields();
//* just trying some stuff, it didn't pan out
//Fields["MyField"].SetFieldFlag(PdfTextFormField.FF_MULTILINE).SetFontSizeAutoScale();
//#This set the value correctly, but it doesn't wrap
Fields["MyField"].SetValue("Field Office Wide - Fuelwood");
//# proof the field is multiline, this is true in debugging
var helpme = Fields["MyField"].IsMultiline();
//# proof the field is set correctly, just the display won't wrap
var grrrrr = Fields["MyField"].GetValue();
//# make the PDF read-only and remove the form fields
TheForm.FlattenFields();
这是我使用 Acrobat Reader 2017 手动输入的 PDF 表单输出
这是代码的输出
这是一个希望匿名的文件版本 https://github.com/Wyseguys/wyseguys.github.io/blob/Wyseguys-patch-1/form.pdf(这不是什么大秘密,只是保持安静)
另外,这可能是一个相关的问题,我现在正在探索 Text not fitting into form fields (iTextSharp)
【问题讨论】:
-
请分享有问题的 PDF,以便重现问题。或者,如果它是机密的,则创建另一个只包含与问题 PDF 中相同的问题字段。
-
@mkl 谢谢。我添加了一个链接。
-
我会在下周初调查。