You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Johanneke Lamberink <jo...@onior.com> on 2015/04/22 10:15:33 UTC

Getting the pagenumber of a PDPage

Hi,

I'm trying to get the pagenumber of a given PDPage.
What I have is:
document.getPages().indexOf(page)

No matter the page I input, I always get the same result, which is equal to the total number of pages
document.getPages().getCount() == document.getPages().indexOf(page) // for every page I input.

Is this a bug, or am I using the framework incorrectly?

Also, I think it would be great if PDPage had a variable "page" so I wouldn't have to iterate through all the pages to get the index.

Kind regards,


Johanneke Lamberink

Re: Getting the pagenumber of a PDPage

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 22.04.2015 um 10:15 schrieb Johanneke Lamberink:
> Hi,
>
> I'm trying to get the pagenumber of a given PDPage.
> What I have is:
> document.getPages().indexOf(page)
>
> No matter the page I input, I always get the same result, which is equal to the total number of pages
> document.getPages().getCount() == document.getPages().indexOf(page) // for every page I input.
>
> Is this a bug, or am I using the framework incorrectly?
>
> Also, I think it would be great if PDPage had a variable "page" so I wouldn't have to iterate through all the pages to get the index.
>
> Kind regards,
>
>
> Johanneke Lamberink
>

I committed the patch by Andrea.

About your other wish - PDPage is independent of a specific PDF doc. It 
doesn't know its own page.

Tilman

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Getting the pagenumber of a PDPage

Posted by Tilman Hausherr <TH...@t-online.de>.
I will evaluate and probably commit this. Not today, but within the next 
few days.

Note that the change is for 2.0 only

Tilman

Am 22.04.2015 um 10:31 schrieb Andrea Vacondio:
> I think this might be related
> https://issues.apache.org/jira/browse/PDFBOX-2704
>
> On Wed, Apr 22, 2015 at 10:15 AM, Johanneke Lamberink <
> johanneke.lamberink@onior.com> wrote:
>
>> Hi,
>>
>> I'm trying to get the pagenumber of a given PDPage.
>> What I have is:
>> document.getPages().indexOf(page)
>>
>> No matter the page I input, I always get the same result, which is equal
>> to the total number of pages
>> document.getPages().getCount() == document.getPages().indexOf(page) // for
>> every page I input.
>>
>> Is this a bug, or am I using the framework incorrectly?
>>
>> Also, I think it would be great if PDPage had a variable "page" so I
>> wouldn't have to iterate through all the pages to get the index.
>>
>> Kind regards,
>>
>>
>> Johanneke Lamberink
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Getting the pagenumber of a PDPage

Posted by Andrea Vacondio <an...@gmail.com>.
I think this might be related
https://issues.apache.org/jira/browse/PDFBOX-2704

On Wed, Apr 22, 2015 at 10:15 AM, Johanneke Lamberink <
johanneke.lamberink@onior.com> wrote:

> Hi,
>
> I'm trying to get the pagenumber of a given PDPage.
> What I have is:
> document.getPages().indexOf(page)
>
> No matter the page I input, I always get the same result, which is equal
> to the total number of pages
> document.getPages().getCount() == document.getPages().indexOf(page) // for
> every page I input.
>
> Is this a bug, or am I using the framework incorrectly?
>
> Also, I think it would be great if PDPage had a variable "page" so I
> wouldn't have to iterate through all the pages to get the index.
>
> Kind regards,
>
>
> Johanneke Lamberink
>