• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Slideshow for PDFs question

Scheduled Pinned Locked Moved Forum
13 Posts 3 Posters 941 Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Away
    sdetweil @sdetweil
    last edited by sdetweil Feb 24, 2025, 7:50 PM Feb 24, 2025, 7:49 PM

    @kochb1988 here is a lib someone could use to create a module

    https://www.npmjs.com/package/pdfjs-dist

    the module would need to create a canvas element for the
    library to draw in. not hard
    use the getscripts: method to load the lib for browser access

    Sam

    How to add modules

    learning how to use browser developers window for css changes

    C 1 Reply Last reply Feb 25, 2025, 3:54 PM Reply Quote 0
    • C Offline
      chrisfr1976 @sdetweil
      last edited by Feb 25, 2025, 3:54 PM

      @sdetweil

      Challenge accepted :)

      MMM-PDFSlideshow

      I had some time today so I sat down and created something. Maybe useful. I’ll upload some Asterix-pdf to my mirror.

      I’m happy with this status. If anyone needs modifications create a pull request. I’m not happy with the fullscreen behavior since the scaling does not work as expected (fullscreen always uses the full width, so a full page display is not nice in landscape orientation). But I do not really need this.

      Regards, Chris.

      S 1 Reply Last reply Feb 25, 2025, 3:57 PM Reply Quote 2
      • S Away
        sdetweil @chrisfr1976
        last edited by sdetweil Feb 25, 2025, 3:59 PM Feb 25, 2025, 3:57 PM

        @chrisfr1976 cool. why fullscreen or if set to fullscreen position?

        can be sized w css

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        C 1 Reply Last reply Feb 25, 2025, 4:19 PM Reply Quote 0
        • C Offline
          chrisfr1976 @sdetweil
          last edited by Feb 25, 2025, 4:19 PM

          @sdetweil Hi, this is the rest of my tries to show the page in 100% in fullscreen mode. So if position is set to a fullscreen region then also the fullscreen flag must be activated.

          Regards, Chris.

          S 1 Reply Last reply Feb 25, 2025, 4:37 PM Reply Quote 0
          • S Away
            sdetweil @chrisfr1976
            last edited by sdetweil Feb 25, 2025, 5:07 PM Feb 25, 2025, 4:37 PM

            @chrisfr1976 cool, should be possible to control in fullscreen w css.

            in car, does this support url to pdf, or just local file?
            (just local file)

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            C 1 Reply Last reply Feb 25, 2025, 6:48 PM Reply Quote 0
            • C Offline
              chrisfr1976 @sdetweil
              last edited by Feb 25, 2025, 6:48 PM

              @sdetweil
              Hi,
              now also hosted PDF-files are supported. PDF with url have now the lead. The local pdfs/ folder is the fall-back if no URL is set or in case of any errors.

              But:
              Most remote PDF is being blocked due to Cross-Origin Resource Sharing restrictions. The server hosting the PDF (https://www.w3.org/… etc.) is not allowing MagicMirror to access its resource. So the server-side PDF is downloaded locally and saved in a folder. Once the file exists locally, the download isn’t performed again. So if the server pdf is updated then the local download must be deleted.

              • If a URL-PDF (or one single PDF) should be displayed change displayTime: 10000, to a higher value (avoid flickering)
              • If a downloaded and local pdf should be displayed then copy or move the pdf from the pdfURL to pdfs folder and leave the URL in the config blank.

              I think there are some optimizations in file handling possible and maybe a new PDF-URL can be sent with MMM-Remote module. But I won’t work on that any further. I will use the local folder in general (if I use the module at all - don’t know).

              Regards, Chris.

              S 1 Reply Last reply Feb 25, 2025, 7:24 PM Reply Quote 0
              • S Away
                sdetweil @chrisfr1976
                last edited by Feb 25, 2025, 7:24 PM

                @chrisfr1976 have you looked at the cors server api we provide?

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                C 1 Reply Last reply Feb 25, 2025, 7:25 PM Reply Quote 0
                • C Offline
                  chrisfr1976 @sdetweil
                  last edited by Feb 25, 2025, 7:25 PM

                  @sdetweil

                  Ö, no :)

                  Where?

                  Regards, Chris.

                  S 1 Reply Last reply Feb 25, 2025, 7:36 PM Reply Quote 0
                  • S Away
                    sdetweil @chrisfr1976
                    last edited by Feb 25, 2025, 7:36 PM

                    @chrisfr1976 not well documented and not 100%

                    http://mm_server:mm_port/cors?url=…,
                    sendheaders=…,
                    receiveheaders=…

                    send/receive headers are headername:value,…

                    code in js/server_functions.js

                    for my readme support in mmm-config i had to fallback to curl/wget

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • 1
                    • 2
                    • 1 / 2
                    1 / 2
                    • First post
                      9/13
                      Last post
                    Enjoying MagicMirror? Please consider a donation!
                    MagicMirror created by Michael Teeuw.
                    Forum managed by Sam, technical setup by Karsten.
                    This forum is using NodeBB as its core | Contributors
                    Contact | Privacy Policy