Read the statement by Michael Teeuw here.
Print
-
@Alexandre-Venditti69 i do not know the answer, don’t use the EXT* modules…
i think if you use that, then u would have to add code to that to get to the image…
i did a quick google search for “print image from browser”
https://stackoverflow.com/questions/52885693/how-to-print-image-from-browser-using-javascript -
@sdetweil great thank so much, I’ve never ser this
very interesting and complete documentation. my first difficulty in all these docs is that the file is always referred to by exact path (ex: /home/pi/img.jpg) and in our EXT module, the image is sent as payload data. how to recover this variable in the print.js script I participated with bugsounet in the writing of the module (especially spectator to understand how it works), I would have liked to make my first pull request, hear the thunder of the printer at the print notification . If a developper interrsting to write this modules with me, or maybe sale me this. -
@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 jQueryif u add a known ID= to the img tag
document.getElementById(…)
then u can get the value of the src= -
@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 -
@Alexandre-Venditti69 console.log(notification)
will dump out the structure of the notification object so u might find the url there -
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 ?
-
@sdetweil thanks for your intention 🙏🏼
-
@sdetweil I read the print.js library, it is of substantial size, does such a volume remain “compatible” with a simple raspberry?
-
@Alexandre-Venditti69 no clue… raspberry pi 3 has 1 gig or memory and pi4 can have up to 8gig.
-
@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