Scroll pdf in jweb

roger.carruthers's icon

Is it possible to programatically control scrolling of a pdf in jweb?
I understand that jweb can receive js messages using executejvascript, but I'm no js programmer and I'm unclear how, or even if this would work to scroll pages of a displayed pdf.
What I'm after is a way to turn pages in a score when certain time points are reached in an audio file...
TIA

roger.carruthers's icon

OK, I worked out that what I was missing was the quote marks, so now I've established (in between crashes) that whilst executejavascript "window.scroll(0, 150);" will work with an .html file, it won't with a .pdf.
Is there any chance this, or something like it can be implemented at some time (once the .pdf crashing issue is solved, of course)?

Joshua Kit Clayton's icon


Regarding the crashing, there are some issues with CEF's PDF renderer that should be solved in a future update when we update to the latest CEF (Chromium Embedded Framework). This likely won't come out in our first big bugfix release, as it will require a longer testing run to make sure it doesn't introduce any worse problems than the ones it will solve.

In the meantime, I would suggest to you a possible solution to both the crashing as well as greater control of your PDF documents:
https://github.com/mozilla/pdf.js/

PDF.js should let you both view PDFs in jweb without crashing, and it also should provide you with an API accessible from your JS code to do things like move through the PDF document:

https://mozilla.github.io/pdf.js/examples/index.html#interactive-examples

Hope this helps!

roger.carruthers's icon

I'll look into, many thanks!

Gary Lee Nelson's icon

I have had excellent results with jweb. What it is missing for me is the ability to send a simple "page #" message to control scrolling. I have multi-page PDF lead sheets with musical notation and lyrics . I want to control paging with the numeric pad

Here is my algorithm (subject to some fine tuning):

· Keys 1-9 jump to the corresponding page. (I can’t imagine one of my PDFs with more than 9 pages. Current max is 4.)

(I am performing live with a wireless computer keyboard in hand accordion style.)

I wonder if we can appeal to the developer to include a page message from the outside attached to the functionality already available inside with the sidebar. It might also be helpful to have an output that tells the number of pages.

My Max patch.

Piano4Me's icon

Hey Gary, I have been looking for something like this for years. Any chance you can share that patch?
Thanks

Gary Lee Nelson's icon

Can't remember how long ago I made this. I have since replaced it with ForScore running on my iPad.
https://forscore.co/

Piano4Me's icon

Thank you for replying Gary. Also thank you for the suggestion. if you ever find it, t would be awesome if you paste it that code here. I’ll be checking from time to time, thanks.

Source Audio's icon

here is a patch I used for pdf notation on Mac.
it uses movie to display pages, some calcs are usings sips
so shell external is needed.
maybe it could be helpfull....

Max Patch
Copy patch and select New From Clipboard in Max.


P.S. it was made with max 6.
max 8 as it seems can not load pdf files into movie objects any more,
what a progress ...

Piano4Me's icon

Thank you so much Source Audio for that patch. I will take it for a spin!!