BBjHtmlView::getImage

Description

In BBj 16.0 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. 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

Copy

BBjHtmlView::getImage Example

rem ' BBjHtmlView::getImage
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(25,25,1000,600,"BBjHtmlView::getImage",$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
client = 0
if info(3,6)<>"5" and info(3,6)<>"6" then
   client = msgbox("BBjHtmlView Client",7+32+512,"BBjHtmlView","Swing","JavaFX","Chromium")
   switch client
      case 1; rem ' Swing
         print stbl("!OPTIONS","CHROMIUM_HTMLVIEW=FALSE",ERR=*NEXT)
         print stbl("!OPTIONS","JAVAFX_HTMLVIEW=FALSE",ERR=*NEXT)
         break
      case 2; rem ' JavaFX
         print stbl("!OPTIONS","CHROMIUM_HTMLVIEW=FALSE",ERR=*NEXT)
         print stbl("!OPTIONS","JAVAFX_HTMLVIEW=TRUE",ERR=*NEXT)
         break
      case 3; rem ' Chromium
         print stbl("!OPTIONS","CHROMIUM_HTMLVIEW=TRUE",ERR=*NEXT)
         print stbl("!OPTIONS","JAVAFX_HTMLVIEW=TRUE",ERR=*NEXT)
         break
   swend
endif
text$ = "<html><head><style>p{margin:0;padding:0;}</style><title>BASIS</title></head><body>"
img$ = "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"
img$ = "https://www.basis.com/sites/basis.com/files/images/BusJGBetter.jpg"
text$ = text$ + "<img src="""+img$+""">"
url$ = "https://documentation.basis.com/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$)
url$ = "http://en.wikipedia.org"
rem htmlview!.setUrl(url$)
htmlview!.setCallback(htmlview!.ON_PAGE_LOADED,"page_loaded")
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()
print title$
window!.setTitle("BBjHtmlView::getImage "+title$)
process_events
eoj:
release
page_loaded:
event! = sysgui!.getLastEvent()
print event!.getEventName()," ",event!.getUrl()
return
getImage:
image!.setImage(htmlview!.getImage())
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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