Jump to content

Recommended Posts

Posted

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.

 

Mike

Posted

It is impossible to do that from server.

And include html as an image inside a report? Modern report generators have enough formatting features, you should rethink the logic of your app.

  • Upvote 1
Posted

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.

 

Thanks,

Mike

post-917-0-44632700-1347111069.png

post-917-0-24441500-1347111095.png

Posted

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.

  • 2 years later...

Join the conversation

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

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