freedowsRoO Posted September 10, 2019 Share Posted September 10, 2019 Hello friends! Is there any way to take print screen of a frame or panel? Thanks in advance Link to comment Share on other sites More sharing options...
Sherzod Posted September 11, 2019 Share Posted September 11, 2019 7 hours ago, freedowsRoO said: Is there any way to take print screen of a frame or panel? Hello, Maybe this is not what you are looking for, but look at this demo example too: \FMSoft\Framework\uniGUI\Demos\Desktop\HTML2Image 1 Link to comment Share on other sites More sharing options...
freedowsRoO Posted September 11, 2019 Author Share Posted September 11, 2019 7 hours ago, Sherzod said: Hello, Maybe this is not what you are looking for, but look at this demo example too: \FMSoft\Framework\uniGUI\Demos\Desktop\HTML2Image Ok i will look for it, thanks. Link to comment Share on other sites More sharing options...
freedowsRoO Posted September 11, 2019 Author Share Posted September 11, 2019 8 hours ago, Sherzod said: Hello, Maybe this is not what you are looking for, but look at this demo example too: \FMSoft\Framework\uniGUI\Demos\Desktop\HTML2Image That's will work! BUT i have only one question. Is there a way to get the HTML of an especific component? Link to comment Share on other sites More sharing options...
freedowsRoO Posted September 11, 2019 Author Share Posted September 11, 2019 up Link to comment Share on other sites More sharing options...
Sherzod Posted September 11, 2019 Share Posted September 11, 2019 1 hour ago, freedowsRoO said: up Hi, You can analyze this js library for example: https://html2canvas.hertzen.com/ 1 Link to comment Share on other sites More sharing options...
freedowsRoO Posted September 11, 2019 Author Share Posted September 11, 2019 54 minutes ago, Sherzod said: Hi, You can analyze this js library for example: https://html2canvas.hertzen.com/ Thanks again =] 1 Link to comment Share on other sites More sharing options...
freedowsRoO Posted September 12, 2019 Author Share Posted September 12, 2019 Hi @Sherzod how do i call this function in a uniButton? Note that in the place of #CAPTURE i need to insert the ID of the element that i want to take a screenshot. function screenshot(){ html2canvas(document.querySelector("#capture")).then( canvas => { var a = document.createElement('a'); a.href = canvas.toDataURL("image/jpeg",1.0).replace("image/jpeg", "image/octet-stream"); a.download = 'somefilename.jpg'; a.click(); }); } i'm trying to do something like this in the ExtEvent of the button but no succes function click(sender, e, eOpts){ '+ html2canvas(document.querySelector( UniTabSheet1.JSName )).then( canvas => { var a = document.createElement("a"); a.href = canvas.toDataURL("image/jpeg",1.0).replace("image/jpeg", "image/octet-stream"); ' a.download = "somefilename.jpg"; a.click(); }); }' ); Link to comment Share on other sites More sharing options...
Sherzod Posted September 13, 2019 Share Posted September 13, 2019 7 hours ago, freedowsRoO said: how do i call this function in a uniButton? Note that in the place of #CAPTURE i need to insert the ID of the element that i want to take a screenshot. Hi, I will try. I will try using UniPanel as an example. 1 Link to comment Share on other sites More sharing options...
freedowsRoO Posted September 13, 2019 Author Share Posted September 13, 2019 7 hours ago, Sherzod said: Hi, I will try. I will try using UniPanel as an example. Thanks a lot! I'm trying to do here either but no succes yet, the problem is that i don't have mutch knwoledge in sencha, i'm learning. Link to comment Share on other sites More sharing options...
Sherzod Posted September 13, 2019 Share Posted September 13, 2019 Hi, Can you try these steps? 1. CustomFiles: files/html2canvas.min.js 2. MainForm.Script: function canvasSaveAs(uri, filename) { var link = document.createElement('a'); if (typeof link.download === 'string') { link.href = uri; link.download = filename; document.body.appendChild(link); link.click(); document.body.removeChild(link); } else { window.open(uri); } } 3. How to use, for example: procedure TMainForm.UniButton2Click(Sender: TObject); var fName: string; begin fName := 'capture' + FormatDateTime('ddmmyyyyhhnnss', Now); UniPanel1.JSInterface.JSCode( 'html2canvas(document.querySelector("#'+ UniPanel1.JSId +'")).then(function(canvas) {'+ ' canvasSaveAs(canvas.toDataURL(), "'+ fName +'");'+ '});' ); end; 3 Link to comment Share on other sites More sharing options...
freedowsRoO Posted September 13, 2019 Author Share Posted September 13, 2019 3 minutes ago, Sherzod said: Hi, Can you try these steps? 1. CustomFiles: files/html2canvas.min.js 2. MainForm.Script: function canvasSaveAs(uri, filename) { var link = document.createElement('a'); if (typeof link.download === 'string') { link.href = uri; link.download = filename; document.body.appendChild(link); link.click(); document.body.removeChild(link); } else { window.open(uri); } } 3. How to use, for example: procedure TMainForm.UniButton2Click(Sender: TObject); var fName: string; begin fName := 'capture' + FormatDateTime('ddmmyyyyhhnnss', Now); UniPanel1.JSInterface.JSCode( 'html2canvas(document.querySelector("#'+ UniPanel1.JSId +'")).then(function(canvas) {'+ ' canvasSaveAs(canvas.toDataURL(), "'+ fName +'");'+ '});' ); end; OMG it's work perctly!! Thanks a lot!! You are the best! 1 Link to comment Share on other sites More sharing options...
freedowsRoO Posted September 13, 2019 Author Share Posted September 13, 2019 Sorry @Sherzod but i have one more problem. If i create i new project your code works fine but when i paste the same code in my real project i receive the message: " html2canvas is not defined" any ideia? Link to comment Share on other sites More sharing options...
Sherzod Posted September 13, 2019 Share Posted September 13, 2019 19 minutes ago, freedowsRoO said: " html2canvas is not defined" any ideia? 9 hours ago, freedowsRoO said: 1. CustomFiles: files/html2canvas.min.js ? 1 Link to comment Share on other sites More sharing options...
freedowsRoO Posted September 13, 2019 Author Share Posted September 13, 2019 5 minutes ago, Sherzod said: ? Yep, it's correctly. So wird because as i said if i create a new project the code works fine Link to comment Share on other sites More sharing options...
Sherzod Posted September 13, 2019 Share Posted September 13, 2019 1 minute ago, freedowsRoO said: Yep, it's correctly. So wird because as i said if i create a new project the code works fine TeamViewer? Link to comment Share on other sites More sharing options...
freedowsRoO Posted September 13, 2019 Author Share Posted September 13, 2019 44 minutes ago, Sherzod said: TeamViewer? Sure ID: 1 145 045 326 pass: ****** Link to comment Share on other sites More sharing options...
Sherzod Posted September 14, 2019 Share Posted September 14, 2019 8 hours ago, freedowsRoO said: If i create i new project your code works fine but when i paste the same code in my real project i receive the message: " html2canvas is not defined" any ideia? Hi, Can you add this code to MainForm.Script and test? Ext.onReady(function() { Ext.Loader.loadScript('files/html2canvas.min.js'); // please correct your path }); 1 Link to comment Share on other sites More sharing options...
freedowsRoO Posted September 14, 2019 Author Share Posted September 14, 2019 6 hours ago, Sherzod said: Hi, Can you add this code to MainForm.Script and test? Ext.onReady(function() { Ext.Loader.loadScript('files/html2canvas.min.js'); // please correct your path }); Same error..... The .JS is loaded but the error persist Link to comment Share on other sites More sharing options...
Sherzod Posted September 15, 2019 Share Posted September 15, 2019 16 hours ago, freedowsRoO said: Same error..... The .JS is loaded but the error persist Hi, Can you try to temporarily remove all third-party components? Link to comment Share on other sites More sharing options...
freedowsRoO Posted September 16, 2019 Author Share Posted September 16, 2019 On 9/15/2019 at 5:07 AM, Sherzod said: Hi, Can you try to temporarily remove all third-party components? i will try 1 Link to comment Share on other sites More sharing options...
freedowsRoO Posted September 16, 2019 Author Share Posted September 16, 2019 On 9/15/2019 at 5:07 AM, Sherzod said: Hi, Can you try to temporarily remove all third-party components? Helllooo!!! I found the problem, did several tests and found that the problem occurs when using the 'UniSyntaxEditEx' component. I dont know wy but thats it. Link to comment Share on other sites More sharing options...
Sherzod Posted September 17, 2019 Share Posted September 17, 2019 16 hours ago, freedowsRoO said: I found the problem, did several tests and found that the problem occurs when using the 'UniSyntaxEditEx' component. I dont know wy but thats it. Hello, Can you make a simple testcase with UniSyntaxEditEx for reproduce this? Thank you. 1 Link to comment Share on other sites More sharing options...
freedowsRoO Posted September 17, 2019 Author Share Posted September 17, 2019 45 minutes ago, Sherzod said: Hello, Can you make a simple testcase with UniSyntaxEditEx for reproduce this? Thank you. Here it is, just remove the UniSyntaxEditEx and the print will work. print error.rar Link to comment Share on other sites More sharing options...
eduardosuruagy Posted April 13, 2020 Share Posted April 13, 2020 Is it possible to leave the image on the server and send it by email? I would not like to download it. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now