Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

Previous items Next items

HTMLViewer.PrintingStartMBS(width as Double, height as Double) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.7 Yes No No No No
Function: Starts the printing code.
Example:
dim i,c as Integer
dim f as FolderItem
dim s as string
dim b as BinaryStream

HTMLViewer1.preferencesMBS.shouldPrintBackgrounds = true // with backgrounds
HTMLViewer1.preferencesMBS.allowsAnimatedImageLooping = true // and with animated images

c=HTMLViewer1.PrintingStartMBS(800,600)
i=0
while i<c
s=HTMLViewer1.PrintingPageMBS(i)

f=SpecialFolder.Desktop.Child("Page "+str(i+1)+".pdf")
b=f.CreateBinaryFile("")
if b<>nil then
b.Write s
b.Close
end if
i=i+1
wend

HTMLViewer1.PrintingEndMBS

MsgBox str(c)+" pages printed."
Notes:
First call PrintingStartMBS with your page size, then call several times PrintingPageMBS and finally call PrintingEndMBS.

Only one print job can be processed at the same time as they use all the same global properties.

Returns the number of pages to be printed.

Some examples which use this method:

Feedback, Comments & Corrections

HTMLViewer.PrintMBS(PDFFile as folderitem=nil) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No No No
Function: Prints the web content without a dialog.
Example:
MsgBox str(HTMLViewer1.PrintMBS)
Notes:
If PDFFile is not nil, printing is redirected to a PDF file.
Returns true on success.

Feedback, Comments & Corrections

HTMLViewer.PrintToPDFFileMBS(PDFFile as folderitem, LeftMargin as Double = 50.0, TopMargin as Double = 50.0, RightMargin as Double = 50.0, BottomMargin as Double = 50.0) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 11.0 Yes No No No No
Function: Prints the PDF to a file.
Example:
dim file as folderitem = Specialfolder.desktop.child("test.pdf")
if not HTMLViewer1.PrintToPDFFileMBS(file) then
msgbox "Failed"
end if
Notes:
This uses the Cocoa printing system to format the web pages into nice pages.
Returns true on success.
Margin is measured in points in the user coordinate space.

Some examples which use this method:

Feedback, Comments & Corrections

HTMLViewer.reloadFromOriginMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 12.4 Yes No No No No
Function: Action method that performs an end-to-end revalidation using cache-validating conditionals if possible.
Notes: Available in OS X v10.6 and later. On older versions the plugin will fall back to normal reload method.

Some examples which use this method:

Feedback, Comments & Corrections

HTMLViewer.ReloadMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No No No
Function: Reloads the current page.
Example:
HTMLViewer1.ReloadMBS

Some examples which use this method:

Feedback, Comments & Corrections

HTMLViewer.RenderDocumentToEPSMBS as Memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 8.0 Yes No No No No
Function: Returns the content of the view as a EPS file's data.
Example:
dim f as FolderItem
dim b as BinaryStream

// create a new pdf with current content of view
f=SpecialFolder.Desktop.Child("test.eps")
b=f.CreateBinaryFile("")
b.Write theHTMLViewer.RenderDocumentToEPSMBS
b.Close

f.Launch // show the pdf in preview
Notes:
Returns nil on any error.
Will resize the eps page to match the size of the website.

Feedback, Comments & Corrections

HTMLViewer.RenderDocumentToPDFMBS as Memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 8.0 Yes No No No No
Function: Returns the content of the view as a PDF file's data.
Example:
dim f as FolderItem
dim b as BinaryStream

// create a new pdf with current content of view
f=SpecialFolder.Desktop.Child("test.pdf")
b=f.CreateBinaryFile("")
b.Write theHTMLViewer.RenderDocumentToPDFMBS
b.Close

f.Launch // show the pdf in preview
Notes:
Returns nil on any error.
Will resize the pdf page to match the size of the website.

Some examples which use this method:

Feedback, Comments & Corrections

HTMLViewer.RenderEPSMBS as Memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No No No
Function: Returns the content of the view as a EPS file's data.
Example:
dim f as FolderItem
dim b as BinaryStream

// create a new pdf with current content of view
f=SpecialFolder.Desktop.Child("test.eps")
b=f.CreateBinaryFile("")
b.Write theHTMLViewer.RenderEPSMBS
b.Close

f.Launch // show the pdf in preview
Notes:
Returns nil on any error.
If there is a scrollbar, it will be included.
For nice printouts, use the webview/htmlviewer printmbs method.

Some examples which use this method:

Feedback, Comments & Corrections

HTMLViewer.RenderPDFMBS as Memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No No No
Function: Returns the content of the view as a PDF file's data.
Example:
dim f as FolderItem
dim b as BinaryStream

// create a new pdf with current content of view
f=SpecialFolder.Desktop.Child("test.pdf")
b=f.CreateBinaryFile("")
b.Write theHTMLViewer.RenderPDFMBS
b.Close

f.Launch // show the pdf in preview
Notes:
Returns nil on any error.
If there is a scrollbar, it will be included.
For nice printouts, use the webview/htmlviewer printmbs method.

Some examples which use this method:

Feedback, Comments & Corrections

HTMLViewer.RenderWebsiteImageMBS(ResolutionScale as Double = 1.0) as NSImageMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No No No
Function: Makes a screenshot of the current displayed content.
Example:
dim f as FolderItem
dim b as BinaryStream
dim i as NSImageMBS
dim p as string

i=HTMLViewer1.RenderWebsiteImageMBS

p=i.PNGRepresentation

f=SpecialFolder.Desktop.Child("test.png")
b=f.CreateBinaryFile("")
b.Write p
Notes:
Nil on failure.
The image returned is the page completely without scrollbars, so it may be a few thousand pixels height and may not fit on a page to print.

The value of this variant must be an object of class NSImageMBS.

Added ResolutionScale in version 13.1 to allow to get high res images. Pass 2 for a retina resolution image (independent of whether your app runs on retina display).

Some examples which use this method:

Feedback, Comments & Corrections

HTMLViewer.resetPageZoomMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 11.0 Yes No No No No
Function: Resets the web page zoom.
Example:
HTMLViewer1.resetPageZoomMBS
Notes: This is a new webview function which is not available on all webview versions. So be aware that you may get an NSExceptionMBS about the function not being available.

Feedback, Comments & Corrections

HTMLViewer.ScrollHeightMBS as single
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property HTMLViewer Mac MBS MacControls Plugin 7.5 Yes No No No No
Function: The height of the scroll view.
Example:
MsgBox str(HTMLViewer1.ScrollWidthMBS)+" "+str(HTMLViewer1.ScrollHeightMBS)
Notes: (Read and Write computed property)

Some examples which use this property:

Feedback, Comments & Corrections

HTMLViewer.ScrollLeftMBS as single
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property HTMLViewer Mac MBS MacControls Plugin 7.5 Yes No No No No
Function: The left position of the scroll view.
Example:
HTMLViewer1.ScrollLeftMBS=HTMLViewer1.ScrollLeftMBS+5
Notes:
You can set this value to scroll manually.
(Read and Write computed property)

Feedback, Comments & Corrections

HTMLViewer.ScrollTopMBS as single
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property HTMLViewer Mac MBS MacControls Plugin 7.5 Yes No No No No
Function: The top position of the scroll view.
Example:
HTMLViewer1.ScrollTopMBS=HTMLViewer1.ScrollTopMBS+5
Notes:
You can set this value to scroll manually.
(Read and Write computed property)

Feedback, Comments & Corrections

HTMLViewer.ScrollWidthMBS as single
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property HTMLViewer Mac MBS MacControls Plugin 7.5 Yes No No No No
Function: The width of the scroll view.
Example:
MsgBox str(HTMLViewer1.ScrollWidthMBS)+" "+str(HTMLViewer1.ScrollHeightMBS)
Notes: (Read and Write computed property)

Feedback, Comments & Corrections

HTMLViewer.SearchForMBS(text as string, Forward as boolean, CaseSensitive as boolean, Wrap as Boolean) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No No No
Function: Searches a document view for a string and highlights the string if it is found.
Example:
call HTMLViewer1.SearchForMBS "holiday",true,false,true
Notes:
Starts the search from the current selection. Will search across all frames.

text: The string to search for.
forward: True to search forward, False to seach backwards.
caseSensitive: True to for case-sensitive search, False for case-insensitive search.

Returns true if found, false if not found.

Some examples which use this method:

Feedback, Comments & Corrections

HTMLViewer.setMaintainsBackForwardListMBS(value as boolean)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.7 Yes No No No No
Function: Whether the back forward history list is created by the webview.
Example:
HTMLViewer1.setMaintainsBackForwardListMBS true
Notes: Default is true.

Feedback, Comments & Corrections

HTMLViewer.setMediaVolumeMBS(value as Double)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 11.0 Yes No No No No
Function: Sets the maximum volume of all sounds generated on this webview.
Example:
HTMLViewer1.setMediaVolumeMBS 0.5
Notes:
Sets a master volume control for all media elements in the WebView. Valid values are 0..1.

This is a new webview function which is not available on all webview versions. So be aware that you may get an NSExceptionMBS about the function not being available.

Feedback, Comments & Corrections

HTMLViewer.SetPageFormatMBS(data as string) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No No No
Function: Loads page format settings from a string.
Notes: Returns true on success and false on failure.

Feedback, Comments & Corrections

HTMLViewer.setPageSizeMultiplierMBS(value as Double)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 11.0 Yes No No No No
Function: Sets the page size multiplier.
Example:
HTMLViewer1.setPageSizeMultiplierMBS 2.0
Notes:
Change the zoom factor of the page in views managed by this webView.
value: A fractional percentage value, 1.0 is 100%.

This is a new webview function which is not available on all webview versions. So be aware that you may get an NSExceptionMBS about the function not being available.

Some examples which use this method:

Feedback, Comments & Corrections

HTMLViewer.StopLoadingMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No No No
Function: Stop any pending loads on the frame's data source, and its children.
Example:
HTMLViewer1.StopLoadingMBS

Some examples which use this method:

Feedback, Comments & Corrections

HTMLViewer.SupportsTextEncodingMBS as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No No No
Function: Find out if the current web page supports text encodings.
Example:
MsgBox str(HTMLViewer1.SupportsTextEncodingMBS)
Notes: Returns true if the document view of the current web page can support different text encodings.

Feedback, Comments & Corrections

HTMLViewer.TextSizeMultiplierMBS as single
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No No No
Function: The size of the text rendering in views managed by this webView.
Example:
HTMLViewer1.LoadPage "<p>Hello</p>", nil
HTMLViewer1.TextSizeMultiplierMBS = 5
Notes:
A fractional percentage value, 1.0 is 100%.
(Read and Write computed property)

Some examples which use this property:

Feedback, Comments & Corrections

HTMLViewer.toolTipMBS as String
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No No No
Function: The tooltip for this htmlviewer.
Example:
HTMLViewer1.toolTipMBS = "Test tooltip"
Notes: (Read and Write computed property)

Feedback, Comments & Corrections

HTMLViewer.userAgentForURLMBS(url as string) as String
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No No No
Function: The user agent used for accessing the given URL.
Example:
msgbox htmlviewer1.userAgentForURLMBS("http://www.apple.com")
// shows: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; de-de) AppleWebKit/419 (KHTML, like Gecko)
Notes: An empty string on failure else the user-agent string for the supplied URL.

Feedback, Comments & Corrections

HTMLViewer.VisibleHeightMBS as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No No No
Function: The visible height of the htmlviewer control.
Example:
MsgBox str(HTMLViewer1.VisibleWidthMBS)+" x "+str(HTMLViewer1.VisibleHeightMBS)
Notes: Bounds is the width and height of the controls area, but visible is only a part depending on the window size. So if Bounds are equal to the visible part, there is no scrollbar.

Feedback, Comments & Corrections

HTMLViewer.VisibleLeftMBS as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.5 Yes No No No No
Function: The left position of the visible area.
Example:
MsgBox str(HTMLViewer1.VisibleLeftMBS)+" x "+str(HTMLViewer1.VisibleTopMBS)
Notes: Should be 0.

Feedback, Comments & Corrections

HTMLViewer.visibleMBS as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No No No
Function: Whether the control is visible.
Example:
MsgBox str(HTMLViewer1.visibleMBS)
Notes:
True is visible and false if hidden.
(Read and Write computed property)

Some examples which use this property:

Feedback, Comments & Corrections

HTMLViewer.VisibleTopMBS as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.5 Yes No No No No
Function: The top position of the visible area.
Example:
MsgBox str(HTMLViewer1.VisibleLeftMBS)+" x "+str(HTMLViewer1.VisibleTopMBS)
Notes: Should be 0.

Feedback, Comments & Corrections

HTMLViewer.VisibleWidthMBS as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method HTMLViewer Mac MBS MacControls Plugin 7.2 Yes No No No No
Function: The visible width of the htmlviewer control.
Example:
MsgBox str(HTMLViewer1.VisibleWidthMBS)+" x "+str(HTMLViewer1.VisibleHeightMBS)
Notes: Bounds is the width and height of the controls area, but visible is only a part depending on the window size. So if Bounds are equal to the visible part, there is no scrollbar.

Feedback, Comments & Corrections

Previous items Next items

The items on this page are in the following plugins: MBS MacControls Plugin.





Links
MBS Xojo Chart Plugins