2013-05-27 35 views
6

正在試圖填補PDF格式 的領域,所以我用下面的代碼pdfsharp和內對

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; 

的問題是,它給誤差的PDF名必須以斜槓(/)開始。

我dsicoverd的document.AcroForm有4對,對其中已經鍵「/場」,如何實現它

+1

看起來好像您從PDFsharp附帶的正在使用的AcroForms示例中獲取代碼。 也許問題出在你正在使用的PDF文件上。 –

+0

我使用了相同的文件,併成功填充了itextsharper – AMH

+1

PDFsharp示例代碼適用於我們的示例PDF文件。它似乎不適用於您的PDF文件。賞金是一個強大的激勵,但沒有你的PDF文件,我不能調查這個問題,因爲我不能複製這個問題。 –

回答

0

我們不能複製錯誤「A PDF名稱必須以斜槓(/)。」與您提供的示例文件。

您提供的示例文件使用的PDF功能尚未受到PDFsharp的支持。該文件不能與PDFsharp一起使用。

不是你正在尋找的答案。這個答案並不是很有用,但如果沒有適當的樣本文件,我們無法幫助你。