BBjHtmlView::getImage

Description

In BBj 16.00 and higher, this method returns a BBjImage corresponding to the contents of a BBjHtmlView control.

Syntax

Return Value

Method

BBjImage

getImage()

Parameters

None.

Return Value

Returns a BBjImage corresponding to the contents of the BBjHtmlView control.

Remarks

This method may not work in all BBjHtmlView clients or with external content. It can take a significant amount of time for a page to be fully rendered. For best results, this method should be invoked from an event handler for the ON_PAGE_LOADED event.

Example

rem ' BBjHtmlView::getImage
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(25,25,1000,600,"BBjHtmlView::getImage",$00090083$)
window!.setCallback(window!.ON_CLOSE,"eoj")
text$ = "<html><head><style>p{margin:0;padding:0;}</style><title>BASIS</title></head><body>"
img$ = "https://www.basis.cloud/sites/basis.com/files/images/BusJGBetter.jpg"
rem ' Image data url eliminates browser CORS issues
bytes! = org.apache.commons.io.IOUtils.toByteArray(new java.net.URL(img$),err=img)
data$ = java.util.Base64.getEncoder().encode(bytes!,err=img)
img$ = "data:image/png;base64," + data$
img: text$ = text$ + "<img src='"+img$+"'>"
url$ = "https://documentation.basis.cloud/BASISHelp/WebHelp/bbjobjects/Window/bbjhtmlview/bbjhtmlview.htm"
text$ = text$ + "<p>This is a <a href="""+url$+""">BBjHtmlView</a>."
text$ = text$ + "</body></html>"
htmlview! = window!.addHtmlView(101,25,25,550,550,text$,"")
htmlview!.setCallback(htmlview!.ON_PAGE_LOADED,"event")
htmlview!.setCallback(htmlview!.ON_HYPERLINK_ACTIVATE,"event")
getImage! = window!.addButton(1,600,25,375,25,"BBjHtmlView::getImage")
getImage!.setCallback(getImage!.ON_BUTTON_PUSH,"getImage")
empty! = bbjapi().getSysGui().getImageManager().loadImageFromBytes("")
image! = window!.addImageCtrl(100,600,75,375,375,empty!)
title$ = htmlview!.getClientType()+" "+htmlview!.getClientVersion()
window!.setTitle("BBjHtmlView::getImage "+title$)
process_events
eoj:
  release
getImage:
  image!.setImage(htmlview!.getImage())
return
event:
  event! = sysgui!.getLastEvent()
  print event!.getEventName()," ",event!.getUrl()
return

Example Type: BBj

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.