-1

我正在写一些你可以称之为公证行为申请的东西。在此应用程序中,保留政府提供的 pdf 模板非常重要。

我正在使用 PDFSharp 读取字段,它非常简单,但是有一件事,文本字段格式。我坚持下去,因为我无法在规范中找到有关格式的任何内容,似乎它是故意遗漏的。

每当有一个字段只接受美元符号、日期或任何受限制的特殊值(例如从 10 到 30 )时,我都无法将其读入应用程序并使其对用户可见(用户有他的自己的字段,比如浏览器中的自动填充,如果有 100% 的可能性是正确的值,则自动为他填充,否则有自动填充)。

var ts = new TypeSwitch().Case((PdfTextField x) =>
{
item1.CharactersLimit = x.MaxLength;
item1.IsMultiline = x.MultiLine;
item1.IsRequired = x.IsRequired();
// what should i do here to read that this field is only 4 places and 2 places after coma, or simply a percentage ?
}

我的问题是:PDFSharp 中有没有办法读取这些格式属性,如果没有,你们是如何解析这些的,如果你不得不这样做的话。

4

1 回答 1

-1

好的,我能够做出的唯一解决方案是:

var formatting = (((field.Where(item => item.Key == "/AA")
                              .Select(item => item.Value)
                              .First() as PdfDictionary).Where(item => item.Key == "/F")
                                                        .Select(item => item.Value)
                                                        .First() as PdfSharp.Pdf.Advanced.PdfReference).Value as PdfDictionary).Where(item => item.Key == "/JS")
                                                                                                       .Select(item => item.Value).First() as PdfString;

之后,我能够提取有关格式的一些信息来制作自定义正则表达式以使验证成为可能,但这就是我所能做的。

不幸的是,它是 PDFSharp。

于 2018-04-23T09:15:23.460 回答