MainPage   Related pages 
Functions | List of all members
WebFormAPI Reference

Functions

double getZoomFactor ()
 
void setZoomFactor (double v)
 
void tpApiAuth (string callbackFunctionName)
 
void authorize (object config, string callbackFunctionName)
 
Header, Footer
void setFooterVisible (bool visible)
 
void setHeaderVisible (bool visible)
 
void showNavigation (bool visible)
 
void showConsole (bool)
 
Printing
string createPdfByTemplate (string templateFileName, string pdfFileName, object printTextBlocks, bool openPdf=true)
 
void setPaperSize (int paperSize)
 
void setOrientation (int orientation)
 
void setPageMargins (double L, double R, double T, double B)
 
double getPageMarginTop ()
 
double getPageMarginBottom ()
 
double getPageMarginLeft ()
 
double getPageMarginRight ()
 
double getLogicalDpi ()
 
URL, Page
void reloadPage ()
 
void loadUrl (string url)
 
void addSuffix (string suffix)
 
void resetSuffixList ()
 
void clearHistory ()
 
void clearHTTPCache ()
 
void redirectUrl (string originalUrl, string redirectUrl)
 
Progress
void showProgress (object v)
 
void hideProgress ()
 
void clearProgressMessage ()
 
void showProgressMessage (string )
 
void showProgressMessageLabel (string )
 
void showProgressValue (double v)
 
void showProgressMessageConsole (string v)
 
int getProgressState ()
 
void processEvents ()
 
void enableInterruptJavaScriptMsg (bool enable)
 

Function Documentation

◆ addSuffix

void addSuffix ( string  suffix)
function

Add a file name extension to the list of suffixes handled by calling windows desktop services when clicked instead of handling within DESITE. All documents ending with one of the file name extensions in this list are handled by calling the desktop services, i.e. using the standard application set in the operating system.

Parameters
suffixfile name extension e.g. '.html'
Remarks
Files with extension '.cpa', '.cpzip', '.pdf' and '.zip' are always forwarded to the operating system.
href-urls starting with 'desiteProject://' are handled as a relative link to a file within the current project folder.
E.g. the following code will try to open the file callback.html within project folder:
<a href='desiteProject://callback.html'>Click here</>
update 2.3.1, 05 dec 2018, ar, url schema 'desiteProject' added

◆ authorize

void authorize ( object   config,
string   callbackFunctionName 
)
function

Trigger a generic authorization flow.
A separate browser window will open for the login process.
If successful, authorization token data will be returned via a callback function, which must take one string parameter (JSON).
Supported authorization methods are OAuth2 and OAuth2 with PKCE.

Important note: It is not recommended to use OAuth2 without PKCE because it requires you to pass a client secret (clientIdentifierSharedKey).
This will obviously be visible in your code, so use it only for tests or if you won't share your WebForm with others!

Parameters
configObject with the following keys:
  • authorizationMethod - allowed values:
    • "oauth2"
    • "oauth2_pkce"
    • "oauth2_tpcde" (a predefined OAuth2 config for the tp CDE API; all other settings will be ignored when using this)
  • scope (usually "openid")
  • authorizationUrl
  • accessTokenUrl
  • clientIdentifier
  • clientIdentifierSharedKey (only required for OAuth2 without PKCE, be aware of the security risk!)
  • callbackUrl
  • callbackPort
  • audience (optional)
  • window (optional)
    • title (default "Authorization required")
    • width (default 500)
    • height (default 900)
callbackFunctionNameName (as a string) of the callback function. That function must take one string parameter (JSON).
Since
3.1.0, 11 Jun 2022

◆ clearHistory

void clearHistory ( )
function
Since
2.0.19, 02 mar 2018, jh

◆ clearHTTPCache

void clearHTTPCache ( )
function

Clear the HTTP cache entries

Since
3.1.0, 17 Aug 2022

◆ clearProgressMessage

void clearProgressMessage ( )
function

Clear progress widget text.

Since
1.4.11

◆ createPdfByTemplate

string createPdfByTemplate ( string  templateFileName,
string  pdfFileName,
object   printTextBlocks,
bool  openPdf = true 
)
function

Create a PDF from a html print template.
Page settings can be configured by setPapersize(), setOrientation() and setMargins(). Page settings configured by the dialog are taken into account as well.

Parameters
templateFileNameText containing the html print template
pdfFileNameSave file name for the PDF. If empty, a file dialog to choose the save file name will be opened.
printTextBlocksReplaces [[printTextBlock##name]] with given key-value pairs
e.g. replace [[printTextBlock##exampleTable]] and [[printTextBlock##exampleUser]] in the given print template.
{
exampleTable: "<table width=100%><tr><td>user</td><td>anonymous</td></tr></table>",
exampleUser: "anonymous"
}
openPdfIf true, the created PDF will be opened after the creation (optional, default: true).
Returns
File Name
'Error' if file could not be printed.
Since
2013
Remarks
2.8.2, optional parameter 'openPdf', allows creation of several PDF without opening them automatically.
2.9.0, parameter 'printTextBlocks', text blocks will now be passed in instead of returning them through getPrintTextBlock method.

◆ enableInterruptJavaScriptMsg

void enableInterruptJavaScriptMsg ( bool  enable)
function

By default, the browser engine will show an interrupt message if scripts take a long time to complete.
You can enable or suppress that message with this call.
To have an effect, this must be done on page initialization (e.g. in the "onLoad" event handler).

Parameters
enabletrue: An interrupt message is shown if a script runs for a long period of time.
false: No message is displayed, the script will run without interruption.
Since
1.5.0, 09 feb 2016, mm

◆ getPageMarginBottom

double getPageMarginBottom ( )
function
Since
2013

◆ getPageMarginLeft

double getPageMarginLeft ( )
function
Since
2013

◆ getPageMarginRight

double getPageMarginRight ( )
function
Since
2013

◆ getPageMarginTop

double getPageMarginTop ( )
function
Since
2013

◆ getProgressState

int getProgressState ( )
function

Get state of the progress widget.

See also
showProgress();
hideProgress();
Returns
0 : undefined / not created
1 : open 2 : closed
Since
1.4.11

◆ getZoomFactor

double getZoomFactor ( )
function
Since
2.0.19, 02 mar 2018, jh

◆ hideProgress

void hideProgress ( )
function

Hide progress widget.

Since
1.4.11

◆ loadUrl

void loadUrl ( string  url)
function

Clear webpage cache and open URL.

◆ processEvents

void processEvents ( )
inlinefunction

Enforce the processing of the event queue.

◆ redirectUrl

void redirectUrl ( string  originalUrl,
string  redirectUrl 
)
inlinefunction

Let the WebForms browser redirect a URL.
Note that this works by simple string replacement, so incomplete/partial addresses will work, and passed parameters will be preserved.

Since
2.5.3, 2019-12-06, ah

◆ reloadPage

void reloadPage ( )
function

Load start page.

◆ resetSuffixList

void resetSuffixList ( )
function

Clear the list of file name extensions handled by calling desktop services.

◆ setFooterVisible

void setFooterVisible ( bool  visible)
function
Since
1.3.7, 01 may 2014, jh

◆ setHeaderVisible

void setHeaderVisible ( bool  visible)
function
Since
1.3.7, 01 may 2014, jh

◆ setOrientation

void setOrientation ( int  orientation)
function

Portrait 0 the page's height is greater than its width. Landscape 1 the page's width is greater than its height.

◆ setPageMargins

void setPageMargins ( double  L,
double  R,
double  T,
double  B 
)
function

Set page margins in mm.

Left, Right, Top, Bottom

◆ setPaperSize

void setPaperSize ( int  paperSize)
function

Set paper size. These values are available

A0 5 841 x 1189 mm
A1 6 594 x 841 mm
A2 7 420 x 594 mm
A3 8 297 x 420 mm
A4 0 210 x 297 mm, 8.26 x 11.69 inches
A5 9 148 x 210 mm
A6 10 105 x 148 mm
A7 11 74 x 105 mm
A8 12 52 x 74 mm
A9 13 37 x 52 mm
B0 14 1000 x 1414 mm
B1 15 707 x 1000 mm
B2 17 500 x 707 mm
B3 18 353 x 500 mm
B4 19 250 x 353 mm
B5 1 176 x 250 mm, 6.93 x 9.84 inches
B6 20 125 x 176 mm
B7 21 88 x 125 mm
B8 22 62 x 88 mm
B9 23 33 x 62 mm
B10 16 31 x 44 mm
C5E 24 163 x 229 mm
Comm10E 25 105 x 241 mm, U.S. Common 10 Envelope
DLE 26 110 x 220 mm
Executive 4 7.5 x 10 inches, 190.5 x 254 mm
Folio 27 210 x 330 mm
Ledger 28 431.8 x 279.4 mm
3 8.5 x 14 inches, 215.9 x 355.6 mm
Letter 2 8.5 x 11 inches, 215.9 x 279.4 mm
Tabloid 29 279.4 x 431.8 mm
Custom 30 Unknown, or a user defined size.
Since
1.3.0, 15 nov 2013, jh

◆ setZoomFactor

void setZoomFactor ( double  v)
function
Since
2.0.19, 02 mar 2018, jh

◆ showConsole

void showConsole ( bool  )
function

Show/hide debug console.

◆ showNavigation

void showNavigation ( bool  visible)
function
Since
2.5.3, 2019-11-22, ah

◆ showProgress

void showProgress ( object   v)
function

Show progress widget.

Parameters
vConfig as JSON

Config:

{
text: true,
bar: true,
label: true,
closeButton: false,
title: "Write data"
}

"text" is for the main window content (multi-line), "label" is a single-line output above the progress bar.

Since
1.4.11
Remarks
2.2.4, 2018-10-09, ah; added "closeButton" option. Previously, the button was always shown but did nothing.

◆ showProgressMessage

void showProgressMessage ( string   )
function

Add a message to the progress widget.

Since
1.4.11

◆ showProgressMessageConsole

void showProgressMessageConsole ( string  v)
function

Print to console.

◆ showProgressMessageLabel

void showProgressMessageLabel ( string   )
function

Set the progress label text (shows at the bottom, above the progress bar)

Since
1.4.11

◆ showProgressValue

void showProgressValue ( double  v)
function

Set value of the progress bar as a floating point number.
Value range [0,1]

Since
1.4.11

◆ tpApiAuth

void tpApiAuth ( string   callbackFunctionName)
function
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

Open the Thinkproject SSO page for authorization for the tp CDE API.
The authorization workflow is asynchronous, therefore the result is reported back through a callback function.

Parameters
callbackFunctionNameName (as a string) of the callback function. That function must take one string parameter (JSON).
See also
authorize()
Since
2.7.1, 13 Oct 2020
2.9.0, 12 Nov 2021 : moved from NavigatorProjectAPI and changed return value to callback
Remarks
Deprecated since 3.1.0, 14 Jun 2022
Deprecated:
Call authorize() with the predefined authorizationMethod for the tp CDE API:
desiteMD.authorize({"authorizationMethod":"oauth2_tpcde"}, callbackFunction.name);

Created: Wed Jun 19 2024 06:16:58