logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

New Topic Post Reply
Options
Go to last post Go to first unread
jmlilly  
#1 Posted : Wednesday, October 7, 2020 10:39:22 AM(UTC)
Quote
jmlilly

Rank: Newbie

Groups: Registered
Joined: 10/7/2020(UTC)
Posts: 1
United States
Location: Valley Home

I need to open a multi-page pdf and extract the values in the fields. I either need to do this page by page, or I need to determine which page each field is on.
How do I do this?


I can do this:
Code:
 var forms = new PdfForms();
 var frm = PdfDocument.Load(fqn, forms);
 foreach (var field in forms.InterForm.Fields)
 {
     if (field.FieldType == Patagames.Pdf.Enums.FormFieldTypes.FPDF_FORMFIELD_TEXTFIELD)
     {
          switch (field.FullName.ToUpper().Trim())
          {

            ... and then evaluate the fields I'm looking for


But isn't this looking at the entire collection of fields for the entire document? Nothing here determines which page the field is on.

I can also do this:
Code:
using (var doc = PdfDocument.Load(fqn)) // C# Read PDF File
{
     foreach (var pg in doc.Pages)
     {
          // Here I'm stuck.  I can't figure out how to get to forms fields from here.


          p++;
          pg.Dispose();
     }
}


Note fqn is my fully qualified file name, a string

Edited by moderator Thursday, October 15, 2020 3:06:20 AM(UTC)  | Reason: Not specified

Paul Rayman  
#2 Posted : Thursday, October 15, 2020 3:05:17 AM(UTC)
Quote
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Hello,

The same field can be displayed on multiple pages. For visual representation of the field, controls are used. Here is the example
https://forum.patagames....e-a-Field-is-On#post1562
Quick Reply Show Quick Reply
Users browsing this topic
Guest
New Topic Post Reply
Forum Jump  
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.