• 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.

Print

Scheduled Pinned Locked Moved Unsolved Requests
11 Posts 2 Posters 2.3k Views 2 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 @Alexandre-Venditti69
    last edited by sdetweil Jan 6, 2023, 5:06 PM Jan 6, 2023, 5:00 PM

    @Alexandre-Venditti69 well you put the image on the screen by using a url ,

    <img src="url...",
    

    so there u have the url u need to use to print

    u may have to extract it again from the html content at the time of the print request,
    but u can use the dhtml API calls to get it, or jQuery

    if u add a known ID= to the img tag

    document.getElementById(…)
    then u can get the value of the src=

    Sam

    How to add modules

    learning how to use browser developers window for css changes

    A 2 Replies Last reply Jan 6, 2023, 5:27 PM Reply Quote 0
    • A Offline
      Alexandre-Venditti69 @sdetweil
      last edited by Jan 6, 2023, 5:03 PM

      @sdetweil i think if you use that, then u would have to add code to that to get to the image…
      Of course, bugsounet told me i ve have to add console.log(payload) on the notification.
      i ve start to write a new fonction in Ext-Selfies.js, and his node_helper.
      texte du lien this exemple script print on défaut printer , but how i can writte it to resolve the payload

      S 1 Reply Last reply Jan 6, 2023, 5:05 PM Reply Quote 0
      • S Away
        sdetweil @Alexandre-Venditti69
        last edited by sdetweil Jan 6, 2023, 5:05 PM Jan 6, 2023, 5:05 PM

        @Alexandre-Venditti69 console.log(notification)
        will dump out the structure of the notification object so u might find the url there

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        A 1 Reply Last reply Jan 6, 2023, 5:36 PM Reply Quote 0
        • A Offline
          Alexandre-Venditti69 @sdetweil
          last edited by sdetweil Jan 7, 2023, 1:02 PM Jan 6, 2023, 5:27 PM

          @sdetweil

          showLastPhoto: function(result, sendResult = true, showLastOnly = false) {
              var autoValidate = showLastOnly ? true : result.options.autoValidate
              this.IsShooting = true
              var con = document.querySelector("#EXT-SELFIES")
              con.classList.add("shown")
              var rd = document.querySelector("#EXT-SELFIES .result")
              rd.style.backgroundImage = `url(modules/EXT-Selfies/photos/${result.uri})`
              rd.classList.add("shown")
              if (autoValidate) {
                if (this.config.usePreview) {
                  var preview = document.querySelector("#EXT-SELFIES .preview")
                  preview.classList.remove("shown")
                }
                setTimeout(()=>{
                  this.lastPhoto = result
                  if (sendResult) this.sendNotification("EXT_SELFIES-RESULT", result)
                  this.closeDisplayer()
                }, this.config.resultDuration)
              }
            },
          
            validateSelfie: function(result) {
              var preview = document.querySelector("#EXT-SELFIES .preview")
              preview.classList.remove("shown")
              var pannel = document.getElementById("EXT-SELFIES-PANNEL")
              pannel.classList.add("shown")
          
              var sendIcon = document.getElementById("EXT-SELFIES-SEND")
              sendIcon.onclick = ()=> {
                this.lastPhoto = result    // Sauvegarde le selfie en local
                this.sendNotification("EXT_SELFIES-RESULT", result) // Envoi la notif pour EXT-SSender
                this.closeDisplayer()
              }
          

          Dans cette partie, j’ai rajouté à SendIcon :

          this.sendSocketNotification("printResult", payload)
          
          Mon node helper reçoit cette notification et exécutera printResult  function (payload) {}
          

          Est ce un bon début ?

          S 1 Reply Last reply Jan 7, 2023, 1:07 PM Reply Quote 0
          • A Offline
            Alexandre-Venditti69 @sdetweil
            last edited by Jan 6, 2023, 5:36 PM

            @sdetweil thanks for your intention 🙏🏼

            1 Reply Last reply Reply Quote 0
            • A Offline
              Alexandre-Venditti69 @sdetweil
              last edited by Jan 6, 2023, 8:52 PM

              @sdetweil I read the print.js library, it is of substantial size, does such a volume remain “compatible” with a simple raspberry?

              S 1 Reply Last reply Jan 6, 2023, 8:54 PM Reply Quote 0
              • S Away
                sdetweil @Alexandre-Venditti69
                last edited by Jan 6, 2023, 8:54 PM

                @Alexandre-Venditti69 no clue… raspberry pi 3 has 1 gig or memory and pi4 can have up to 8gig.

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply Reply Quote 0
                • S Away
                  sdetweil @Alexandre-Venditti69
                  last edited by Jan 7, 2023, 1:07 PM

                  @Alexandre-Venditti69 said in Print:

                  Est ce un bon début ?

                  sorry, I have no idea.
                  I would have thought u could print directly from the browser, and not have to go to the helper.

                  never tried printing

                  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
                    8/11
                    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