espresso3389 / pdfrx

pdfrx is yet another PDF viewer implementation that built on the top of PDFium. The plugin currently supports Android, iOS, Windows, macOS, Linux, and Web.
MIT License
89 stars 45 forks source link

Current page number = 1 whereas 2 pages are displayed (paysage mode) #198

Open HeropolisDa2ny opened 3 weeks ago

HeropolisDa2ny commented 3 weeks ago

If you have a PDF on paysage with a small amount of pages (like 2) the pageNumber or the onPageChanged will stay at 1 whereas you see all of the pages.

     PdfViewer.data(
        data,
        controller: _controller,
        sourceName: '',
        params: PdfViewerParams(
          margin: ClassSize.paddingPage,
          backgroundColor: Theme.of(context).scaffoldBackgroundColor,
          enableTextSelection: true,
          enableKeyboardNavigation: true,
          onPageChanged: (page) => log(page.toString()),
        ),
      )

Get started in Canva.pdf

espresso3389 commented 3 weeks ago

What is paysage mode?

espresso3389 commented 3 weeks ago

Related: #152 The algorithm to guess the current page is still not perfect and I would like to update the algorithm... though #152 is already closed...

HeropolisDa2ny commented 3 weeks ago

What is paysage mode?

A PDF horizontally not vertically (not portrait)

HeropolisDa2ny commented 3 weeks ago

Related: #152 The algorithm to guess the current page is still not perfect and I would like to update the algorithm... though #152 is already closed...

Yes it seems kind of link but it is another part of the algorithm as I'm looking on the current page.

espresso3389 commented 3 weeks ago

A PDF horizontally not vertically (not portrait)

Sorry, I cannot understand that.

but it is another part of the algorithm as I'm looking on the current page.

Could you please explain more about your issue using screenshot or such? I cannot understand your situation.

HeropolisDa2ny commented 3 weeks ago

A PDF horizontally not vertically (not portrait)

Sorry, I cannot understand that.

but it is another part of the algorithm as I'm looking on the current page.

Could you please explain more about your issue using screenshot or such? I cannot understand your situation.

I gave you my PDF on my first message but here some screenshot :

Screenshot 2024-07-03 at 13 28 23

Screenshot_20240703-213044

As you can see, the two pages of the PDF are rendered on the page but the current page is still: 1 Also the pages of the PDF aren't aligned on the top, they are centered but this is another problem.

espresso3389 commented 3 weeks ago

It's completely correct behavior. In general, we cannot determine which page is the "current page" by it's layout.

So anyway we decide one by some logic. In the case, the current page is 1.

HeropolisDa2ny commented 3 weeks ago

I do partially agree with you. I agree that it might be really hard to determine the current page, however if the second page is rendered on our page and that we cannot scroll on it then the current page should be 2 otherwise we'll never be able to reach the currentPageIndex = 2.

It might be a hard feature to set up but I think it is quite good to have it since people can check this value to know if the user have fully read the document.

But I think it has a really low priority compared to some other opened bugs.