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 :

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?
Upvote 0


B4X founder
Staff member
Licensed User
This code saves the webview content to a bitmap:
Sub WebView1_PageFinished (Success As Boolean, Url As String)
   If Success Then
     Dim iv As ImageView
     iv.SetLayoutAnimated(0, 1, 0, 0, WebView1.Width, WebView1.Height)
     Dim cvs As Canvas
     cvs.DrawView(WebView1, cvs.TargetRect)
     Dim bmp As Bitmap = cvs.CreateBitmap
   End If
End Sub

Note that only the visible WebView content will be saved.
Upvote 0

John Woodsmall

Active Member
Licensed User
ok...i see...
now how do i
1.) slice the bmp (above) to match the "good_part" below
2.) display the sliced bmp into a page as an image?


  • Whole_Page_Sent_Back.gif
    56 KB · Views: 243
  • Good_Part.gif
    13.1 KB · Views: 241
Upvote 0

John Woodsmall

Active Member
Licensed User
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.)
Upvote 0

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?

Upvote 0