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
stan  
#1 Posted : Thursday, February 21, 2019 1:41:25 PM(UTC)
Quote
stan

Rank: Member

Groups: Registered
Joined: 2/21/2019(UTC)
Posts: 15


Hi,

I need to get the page a field is on.

Thank You
Paul Rayman  
#2 Posted : Thursday, February 21, 2019 10:16:57 PM(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)
Hi,

The field is not associated with the page directly. This is an entity whose visual presentation is carried out by means of PdfControls. Each PdfFeld has one or more controls. Each control associated with the one page. (and yes, that does mean what field can be associated with several pages).

You can get the list of controls for the page and check if desired control contained by the list.

Please look at code

Code:
var forms = new PdfForms();
var document = PdfDocument.Load(filename, forms);

var disiredControl = yourField.Controls[0];

for (int i = 0; i < document.Pages.Count; i++)
{
    var controls = forms.InterForm.GetPageControls(document.Pages[i]);

    foreach (var ctrl in controls)
    {
        if(desiredControl.Dictionary.Handle == ctrl.Dictionary.Handle)
        {
            //Got it!
            break;
        }
    }
}
stan  
#3 Posted : Friday, February 22, 2019 8:03:51 AM(UTC)
Quote
stan

Rank: Member

Groups: Registered
Joined: 2/21/2019(UTC)
Posts: 15

Thank you very much!
Quick Reply Show Quick Reply
Users browsing this topic
Guest (2)
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.