我试图填写pdf表单的字段,所以我使用以下代码
string filePath = @"c:\test.pdf";
string newPath = @"E\Result";
if(File.Exists(filePath))
{
PdfDocument document = PdfReader.Open(filePath, PdfDocumentOpenMode.Modify);
// Get the root object of all interactive form fields
PdfAcroForm form = document.AcroForm;
// Get all form fields of the whole document
PdfAcroField.PdfAcroFieldCollection fields = document.AcroForm.Fields; //"/Fields"
string[] names = fields.Names;
names = fields.DescendantNames;
Run Code Online (Sandbox Code Playgroud)
问题是它给出错误PDF名称必须以斜杠(/)开头.
我知道document.AcroForm有4对,其中有关键字"/ Fields",如何到达它
我们无法复制错误“PDF 名称必须以斜杠 (/) 开头”。与您提供的示例文件。
您提供的示例文件使用了 PDFsharp(尚)不支持的 PDF 功能。该文件不能与 PDFsharp 一起使用。
不是您正在寻找的答案。这个答案并没有多大帮助,但如果没有适当的示例文件,我们无法为您提供帮助。