iOS Question cutting a part of a web page into another image

John Woodsmall

Active Member
Licensed User
I have a web page that displays fine. I need to cut a portion of it
and display it as an image. Also I do not want to display the web page
only the image that I have cut into an image.
 

John Woodsmall

Active Member
Licensed User
all i know is :

WebView2
.LoadUrl(target0)
i then display the page where webview2 is.
So if you don't mind can you show me the simple steps to get the web page into an image
that I can slice up and then show the image instead of the web page?

I asume that I can the routines you pointed to...but how?
 

Erel

Administrator
Staff member
Licensed User
This code saves the webview content to a bitmap:
B4X:
Sub WebView1_PageFinished (Success As Boolean, Url As String)
   If Success Then
     Dim iv As ImageView
     iv.Initialize("")
     iv.SetLayoutAnimated(0, 1, 0, 0, WebView1.Width, WebView1.Height)
     Dim cvs As Canvas
     cvs.Initialize(iv)
     cvs.DrawView(WebView1, cvs.TargetRect)
     cvs.Refresh
     Dim bmp As Bitmap = cvs.CreateBitmap
   End If
End Sub
Note that only the visible WebView content will be saved.
 

John Woodsmall

Active Member
Licensed User
ok
so somehow i am ment to call the drawbitmap subrountine above?
from the webview1 sub above?
and the canvus will then apear on the page?
(as you can see I barely know the correct words to talk to you...but I am articulate in other lang.)
 

John Woodsmall

Active Member
Licensed User
can you give me an example of a web page reached:WebView2.LoadUrl(target0)
and then a script that saves(optains it) to an image and then a script that cuts the image
as required and then displays that image to a page?

thanks!
 
Top