0
我在一些程序中使用了一些Syncfusion PDF工具。一個程序通過foreach循環從PdfLoadedDocument
的Form
屬性讀取字段(並根據一些屬性值進行一些記錄保存)。這工作正常。沒有窗體在Syncfusion PDF上添加字段
我有另一個程序,需要PDF文檔,似乎並不總是有Form
屬性(doc.Form
爲空)。顯然,這是試圖添加一個字段,這樣當一個問題:
PdfLoadedDocument PDF = new PdfLoadedDocument(@"C:\Me\Desktop\test.pdf");
PdfLoadedForm Form = PDF.Form; //Form is null
PdfLoadedPage Page = (PdfLoadedPage)PDF.Pages[0];
//Problem is, form is null for this line
PDF.Form.Fields.Add(new TextField(Page, "TEST_NAME"));
似乎沒有要任何方式設置/創建一個新的Form
從什麼我可以在Syncfusion找到添加到文檔中文檔。這使得這個程序中的任何內容都無法像我之前提到的程序那樣運行(沒有窗體可以讀取字段)。我在這裏錯過了什麼,或者以錯誤的方式解決了這個問題?