Jump to content

Help needed with UniHTLMFrame.PaintTo


Recommended Posts

Has anybody used the PaintTo method of UniHTMLFrame? I want to save the contents of the UniHTMLFrame as an image so that it can be included in a report but I am struggling. I have tried using a UniImage and a UniCanvas as the target but all I get is a blank image.


Any help/pointers would be appreciated.



Link to comment
Share on other sites

Thanks Zilav.


Maybe if I explain exactly what I am trying to do, you will see why I want to save the UniHTMLFrame image.


My application has a Client Record form which contains a UniHTMLFrame to display the client's location on a Google map. A summary of the Client Record can be printed, using FastReports, and I want to include the Google map image on this summary report to help in locating the client's address. The attached images show how it looks in the original application, which used a TWebBrowser to display the map.


The TWebBrowser allows access to the ViewObject using:

WebBrowser1.Document.QueryInterface(IViewObject, viewObject)

which can then be drawn on a bitmap canvas and saved to a stream, from which it can be used by the report.


I thought that the PaintTo method of UniHTMLFrame would allow me to do something similar but, it seems not.


Perhaps an Ajax event might do the trick, but I am not smart enough to know where to begin.


Maybe if I rephrased the original topic title as "How do I include a Google Map from a UniHTMLFrame in a report?" it would describe my problem more accurately.






Link to comment
Share on other sites

I see what you try to achieve, but remote server taking a snapshot of client browser? Impossible.

You should make your report as a separate static html page (including google map), save it to a file, and then link it with UniLabel:


<a href="report.html" target="_blank">Print</a>

When user clicks this link, a new tab/window will open with your report and user can print it from browser.

Link to comment
Share on other sites

  • 2 years later...
  • Administrators

How to obtain the html code of a page open in UniURLFrame1.URL.



// Loading the site



// Getting html code site after being loaded

UniMemo1.text: = UniURLFrame1.html.text;


My problem is getting the code, someone can help me with this?


Please do not flood forums with same question!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...