2012-10-29 2 views
0

우리는 어떻게 PdfTextField가 포함 된 PpdfPage를 가져와야합니까?PdfTextField가 포함 된 PDF 페이지 가져 오기

코드 :

protected int PaginaCampo(string campofirma, PdfDocument document) 
{ 
    for (int i = 0; i < document.Pages.Count; i++) 
    { 
     PdfAnnotations anotations = document.Pages[i].Annotations; 
     for (int j = 0; j < anotations.Count; j++) 
     { 
      if (anotations[j].Title != campofirma) continue; 
      return i; 
     } 
    } 
    return -1; 
} 

아니 최고의 솔루션 있지만 작동 ... 사람이 하나 더 추가하는 경우 우리가를 줄 것이다 : 결국

PdfDocument document = PdfReader.Open("C:\\filex.pdf", 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 = form.Fields; 

PdfTextField textfield1= (PdfTextField)fields["textfield1"]; 

//how to get the correct page reference respect the especified field? 
PdfPage page = textfield1.Owner.Pages[???]; 
+0

itextsharp를 사용중인 라이브러리는 무엇입니까? – retslig

+1

태그에 따르면 pdfsharp입니다. – mkl

+0

@retslig PdfSharp, 과거에는 itextsharp를 사용했지만 PdfSharp 라이센스는 더 개방되어 있습니다. – VSP

답변

0

우리는이 기능을 만들어 해결 그/그녀의 정답 인

관련 문제