Hopding / pdf-lib

Create and modify PDF documents in any JavaScript environment
https://pdf-lib.js.org
MIT License
6.9k stars 657 forks source link

Custom UI: is it possible? #854

Closed issimissimo closed 3 years ago

issimissimo commented 3 years ago

Hello, sorry for my dummy question, I'm really a newby to pdf-lib. It look awesome, but would it be possible to customize the UI (prev-next page buttons, etc..) ? I can't see any reference to the UI on the docs. Many thanks!

giovanni-orciuolo commented 3 years ago

What do you mean with "UI"? A PDF file does not include a UI by any means. The UI you are referring to is probably the one provided by your own reader program (e.g. Adobe/Chrome). Hence you can't modify the UI from this library.

Trapfether commented 3 years ago

@issimissimo You're most likely referring to the viewer that pdf-lib ships with. In the docs you can see that the viewer has very few options ViewerPreferences. While you could monkey patch your adjustments, you'll likely find it easier to use a sperate pdf display library for the time being. I personally use pdf.js

Hopding commented 3 years ago

pdf-lib doesn't actually provide a viewer at all. The ViewerPreferences are only used to configure how a PDF document is treated when opened by a viewer (like pdf.js, Acrobat, etc...).