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

Notification

Icon
Error

Options
Go to last post Go to first unread
stan  
#1 Posted : Thursday, February 21, 2019 4:41:25 PM(UTC)
stan

Rank: Newbie

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


Hi,

I need to get the page a field is on.

Thank You
Paul Rayman  
#2 Posted : Friday, February 22, 2019 1:16:57 AM(UTC)
Paul Rayman

Rank: Administration

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

Thanks: 1 times
Was thanked: 87 time(s) in 86 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 11:03:51 AM(UTC)
stan

Rank: Newbie

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

Thank you very much!
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.