使用 RTL 时,带有 C# acroforms 的 IText 7 扁平化问题
IText 7 with C# acroforms flattening problem when working with RTL
我正在使用 IText 7 和 C# 以编程方式填写“acroForms”。
我在处理 RTL 语言时发现了如何做到这一点。
当我需要禁用(展平)输入字段时出现问题,值消失。
当我使用 LTR(英语)时,值被禁用 - 扁平化并且一切正常。
代码:
PdfDocument pdf = new PdfDocument(new PdfReader(@"C:\test\test.pdf"), new PdfWriter(@"C:\test\test2.pdf"));
PdfAcroForm form = PdfAcroForm.GetAcroForm(pdf, true);
form.SetNeedAppearances(true);
IDictionary<String, PdfFormField> fields = form.GetFormFields();
PdfFormField toSet;
fields.TryGetValue("CM@SHEM_PRATI@1", out toSet);
toSet.SetValue("גגג");
form.PartialFormFlattening("CM@SHEM_PRATI@1");
form.FlattenFields();
pdf.Close();
我是否错过了展平 RTL 插入字段的配置?
有没有其他方法可以使用 C# Itext 7 禁用输入字段?
问题已解决。
我添加了 itext7.pdfcalligraph add-on。
然后在上面的代码中添加了一个rtl字体:
PdfFont heb = PdfFontFactory.CreateFont(@"/path/to/font.ttf", "Identity-H", true);
toSet.SetFont(heb);
输入字段变平了,但仍然可以看到值。
我正在使用 IText 7 和 C# 以编程方式填写“acroForms”。 我在处理 RTL 语言时发现了如何做到这一点。
当我需要禁用(展平)输入字段时出现问题,值消失。
当我使用 LTR(英语)时,值被禁用 - 扁平化并且一切正常。
代码:
PdfDocument pdf = new PdfDocument(new PdfReader(@"C:\test\test.pdf"), new PdfWriter(@"C:\test\test2.pdf"));
PdfAcroForm form = PdfAcroForm.GetAcroForm(pdf, true);
form.SetNeedAppearances(true);
IDictionary<String, PdfFormField> fields = form.GetFormFields();
PdfFormField toSet;
fields.TryGetValue("CM@SHEM_PRATI@1", out toSet);
toSet.SetValue("גגג");
form.PartialFormFlattening("CM@SHEM_PRATI@1");
form.FlattenFields();
pdf.Close();
我是否错过了展平 RTL 插入字段的配置? 有没有其他方法可以使用 C# Itext 7 禁用输入字段?
问题已解决。 我添加了 itext7.pdfcalligraph add-on。 然后在上面的代码中添加了一个rtl字体:
PdfFont heb = PdfFontFactory.CreateFont(@"/path/to/font.ttf", "Identity-H", true);
toSet.SetFont(heb);
输入字段变平了,但仍然可以看到值。