pdfme / pdfme

A TypeScript based PDF generator library, made with React.
https://pdfme.com
MIT License
2.16k stars 192 forks source link

Make pageCursor publicly available in the Designer #442

Closed Letsmoe closed 2 months ago

Letsmoe commented 2 months ago

Is your feature request related to a problem? Please describe.

When working with multiple pages it's impossible to tell which page we're currently on without inspecting the dom or writing your own page scroll observer making it unnecessarily difficult to use a schema for each page individually.

Describe the solution you'd like

The pageCursor property already exists, it would just be a matter of exposing it as a public property of the Designer class.

Describe alternatives you've considered

/

Additional context

I'd be happy to create a pr for this.

hand-dot commented 2 months ago

Hey @Letsmoe, Could you explain a bit more why we should add this feature? I'd like to understand use case.

Letsmoe commented 2 months ago

If I'm not mistaken it's not currently possible to tell which page the user is on in the designer, right? That makes it practically impossible to put new fields into the correct schema objects and since there is no way to move fields between pages in the designer you basically cannot place objects on the pages following the first one. Is there maybe another way that I simply overlooked? Otherwise having the current page available would be a major thing especially when creating new pages on the fly and auto-generating page numbers for them.

hand-dot commented 2 months ago

Thank you @Letsmoe ,

Does the following PR seem to solve your problem? https://github.com/pdfme/pdfme/pull/445

Letsmoe commented 2 months ago

Yep, sure does!

hand-dot commented 2 months ago

Perfect!!!

hand-dot commented 2 months ago

This Request was handled by https://github.com/pdfme/pdfme/pull/446 We can use getPageCursor from pdfme@3.4.1.