SergioFeitoza Posted March 21, 2021 Share Posted March 21, 2021 When I am running my code I need to save as jpeg or pdf a screenshot of that page. I found the sample \FMSoft\Framework\uniGUI\Demos\Desktop\HTML2Image that seems to do more or less what I need As written in the demo it is necessary to install an external tool downloadable in from https://wkhtmltopdf.org/ and install it. My question is : is there any resource available which does not request to install the external tool ? Thanks in advance Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 21, 2021 Share Posted March 21, 2021 44 minutes ago, SergioFeitoza said: My question is : is there any resource available which does not request to install the external tool ? Hello, This post may help you: Quote Link to comment Share on other sites More sharing options...
SergioFeitoza Posted March 21, 2021 Author Share Posted March 21, 2021 14 minutes ago, Sherzod said: Hello, This post may help you: Thanks Sherzod Looks great Tomorrow I will try with it Quote Link to comment Share on other sites More sharing options...
SergioFeitoza Posted March 22, 2021 Author Share Posted March 22, 2021 23 hours ago, SergioFeitoza said: Thanks Sherzod Looks great Tomorrow I will try with it Hi Sherzod I followed your suggestion and worked in it. I could run the code below without errors but do not know where the screenshot was saved (no visualization cames).. Unfortunately my code is very big to post here and be understood. . My intention is to SAVE a printscreen of the complete page (pdf or jpg or png ) and after to send it by e-mail. I need to screenshot the whole page and not just a component of the page as in the code below (the tunipanel named pnlTSaccount ) I need to screenshot like is done here https://html2canvas.hertzen.com/ (Click button TRYOUT and after button CAPTURE) I know how to send by email if I know the directory where the screenshot was saved. I have 3 doubts. 1) If I replace the the panel pnlTSaccount of the code below by "MainForm" it does not compile. The many components of my main page are not in a single container. So I need a printscreen of the whole page.. . What should I do ? 2) I do not understand yet in which directory the screenshot is saved. I checked the directory ... FILES but was not there. I included Files in the ervermodule.customfiles How to write the code below to save the screenshot in the ...Files directory? 3) What should I write in the text below to save the screenshot as jpeg ? ------------------------------------ procedure TMainForm.ReportViaEmailClick(Sender: TObject); var fName: string; begin fName := 'capture' + FormatDateTime('ddmmyyyyhhnnss', Now); pnlTSaccount.JSInterface.JSCode( 'html2canvas(document.querySelector("#'+ pnltopmain.JSId +'")).then(function(canvas) {'+ ' canvasSaveAs(canvas.toDataURL(), "'+ fName +'");'+ '});' ); ///// UniMainModule.SMTPSEND(LOGIN, USERNAME,'REPORT'); ///// SMTPSEND SMTPSEND ///// showMessage(' Check your e-mail inbox. This page is attached to an e-mail'); end Quote Link to comment Share on other sites More sharing options...
SergioFeitoza Posted March 23, 2021 Author Share Posted March 23, 2021 19 hours ago, SergioFeitoza said: Hi Sherzod I followed your suggestion and worked in it. I could run the code below without errors but do not know where the screenshot was saved (no visualization cames).. Unfortunately my code is very big to post here and be understood. . My intention is to SAVE a printscreen of the complete page (pdf or jpg or png ) and after to send it by e-mail. I need to screenshot the whole page and not just a component of the page as in the code below (the tunipanel named pnlTSaccount ) I need to screenshot like is done here https://html2canvas.hertzen.com/ (Click button TRYOUT and after button CAPTURE) I know how to send by email if I know the directory where the screenshot was saved. I have 3 doubts. 1) If I replace the the panel pnlTSaccount of the code below by "MainForm" it does not compile. The many components of my main page are not in a single container. So I need a printscreen of the whole page.. . What should I do ? 2) I do not understand yet in which directory the screenshot is saved. I checked the directory ... FILES but was not there. I included Files in the ervermodule.customfiles How to write the code below to save the screenshot in the ...Files directory? 3) What should I write in the text below to save the screenshot as jpeg ? ------------------------------------ procedure TMainForm.ReportViaEmailClick(Sender: TObject); var fName: string; begin fName := 'capture' + FormatDateTime('ddmmyyyyhhnnss', Now); pnlTSaccount.JSInterface.JSCode( 'html2canvas(document.querySelector("#'+ pnltopmain.JSId +'")).then(function(canvas) {'+ ' canvasSaveAs(canvas.toDataURL(), "'+ fName +'");'+ '});' ); ///// UniMainModule.SMTPSEND(LOGIN, USERNAME,'REPORT'); ///// SMTPSEND SMTPSEND ///// showMessage(' Check your e-mail inbox. This page is attached to an e-mail'); end Any idea? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 23, 2021 Share Posted March 23, 2021 Hi, If I am not mistaken, you need to analyze this post: Quote Link to comment Share on other sites More sharing options...
SergioFeitoza Posted March 23, 2021 Author Share Posted March 23, 2021 4 minutes ago, Sherzod said: Hi, If I am not mistaken, you need to analyze this post: Hi Sherzod This is one of the good posts I went through before writing. However even after running the code above I remained with these basic doubts: 1) If I replace the name of a component to snapshot by "MainForm" it does not compile. The many components of my main page are not in a single container. So I need a printscreen of the whole page.. . What should I do ? 2) I do not understand yet in which directory the screenshot is saved. I checked the directory ... FILES but was not there. I included Files in the ervermodule.customfiles How to write the code below to save the screenshot in the ...Files directory? 3) What should I write to save the screenshot as jpeg ? 1 Quote Link to comment Share on other sites More sharing options...
SergioFeitoza Posted March 24, 2021 Author Share Posted March 24, 2021 If I am in my computer and want to save a printscreen on my C:/sergiodirectory I do: a) Click the keyboard key PrintScreen b) Open my old Paint c) Click Control+V putting the myimage in Paint d) SaveAs myImage in the directory C:/sergiodirectory e) What is the Unigui code (and where to insrt it step by step) that I have to write in my Unigui code to do exactly this ? 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.