# NGDesktop Utils (ref)

(part of package '[NGDesktop Utils](/reference/servoyextensions/packages/browser-plugin-packages/ngdesktop-utils.md)')

You can access it in code via: **plugins.ngdesktoputils**

## API

### executeCommand(program,args)

Executes a command async, the server side call will not block on this call.

**Parameters:**

> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} program
> * {[Array\<Object>](/reference/servoycore/dev-api/js-lib/object.md)} args

***

### executeCommandSync(program,args)

This executes a command and returns the result of the stdout This will also call reject when a error happens so the call will error out. (will not return correct) Try to use the async executeCommand so nothing will be blocking.

**Parameters:**

> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} program The command to be executed
> * {[Array\<Object>](/reference/servoycore/dev-api/js-lib/object.md)} args The command arguments

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The result from standard output.

***

### exit()

This will close the NGDesktop main application.\
Be sure you will call this and after this call application.exit() to close also the client directly itself.

***

### getClipboardContent()

Get clipboard text.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The clipboard text.

***

### getDefaultPrinter()

Returns default printer on local machine.

**Returns:** [CustomType\<ngdesktoputils.printer>](#printer) The default printer object.

***

### getPrinters()

Returns installed printers on local machine.

**Returns:** [Array\<CustomType\<ngdesktoputils.printer>>](#printer) An array of printer objects.

***

### getSystemInformation()

Retrieve information from the ngdesktop client

**@return** {CustomType\<ngdesktoputils.sysinfo>}

```
an object containing the client's system information:

    ngDesktopVersion    - string: ngdesktop version
    osPlatform          - string: can be 'darwin', 'linux', 'freebsd', 'openbsd' and 'win32'
    osRelease           - string: kernel release number
    osTotalMem          - long: total system's memory
    osFreeMem           - long: total available memory
```

**Returns:** [CustomType\<ngdesktoputils.sysinfo>](#sysinfo) `an object containing the client's system information:ngDesktopVersion - string: ngdesktop versionosPlatform - string: can be 'darwin', 'linux', 'freebsd', 'openbsd' and 'win32'osRelease - string: kernel release numberosTotalMem - long: total system's memoryosFreeMem - long: total available memory`

***

### isNGDesktop()

Whether application is running as NGDesktop.

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) True if app running inside NGDesktop, false otherwise.

***

### printPDF(path,options )

Prints a pdf document specified by path. Optionally, specify printer or unix print options (lp command) or windows print options see: <https://github.com/Servoy/pdf-to-printer>

**Parameters:**

> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} path
> * {[CustomType\<ngdesktoputils.printoptions>](#printoptions)} \[options]

***

### setClipboardContent(text)

Set clipboard text.

**Parameters:**

> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} text To be set in clipboard

***

### showExternal(url)

Manage URLs using their default applications

**Parameters:**

> * {[String](/reference/servoycore/dev-api/js-lib/string.md)} url The URL to be opened.

***

## Types

## printer

Contains printer information. scripting type: CustomType\<ngdesktoputils.printer>

* deviceId
  * The device identifier for the printer.
  * **Type**: [string](/reference/servoycore/dev-api/js-lib/string.md)
* name
  * The name of the printer.
  * **Type**: [string](/reference/servoycore/dev-api/js-lib/string.md)
* paperSizes
  * An array of supported paper sizes.
  * **Type**: [string\[\]](/reference/servoycore/dev-api/js-lib/string.md)

## printoptions

Contains print options for different platforms. scripting type: CustomType\<ngdesktoputils.printoptions>

* printer
  * The printer identifier or name to use.
  * **Type**: [string](/reference/servoycore/dev-api/js-lib/string.md)
* unix
  * An array of Unix-specific printing options.
  * **Type**: [string\[\]](/reference/servoycore/dev-api/js-lib/string.md)
* win32
  * An array of Windows-specific printing options.
  * **Type**: [string\[\]](/reference/servoycore/dev-api/js-lib/string.md)

## sysinfo

Contains system information from the NGDesktop client. scripting type: CustomType\<ngdesktoputils.sysinfo>

* electronVersion
  * The version of Electron used by NGDesktop.
  * **Type**: [string](/reference/servoycore/dev-api/js-lib/string.md)
* ngDesktopVersion
  * The NGDesktop version.
  * **Type**: [string](/reference/servoycore/dev-api/js-lib/string.md)
* osFreeMem
  * The available (free) system memory in bytes.
  * **Type**: [long](/reference/servoycore/dev-api/js-lib/number.md)
* osPlatform
  * The operating system platform (e.g. 'darwin', 'win32', etc.).
  * **Type**: [string](/reference/servoycore/dev-api/js-lib/string.md)
* osRelease
  * The operating system release version.
  * **Type**: [string](/reference/servoycore/dev-api/js-lib/string.md)
* osTotalMem
  * The total system memory in bytes.
  * **Type**: [long](/reference/servoycore/dev-api/js-lib/number.md)

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.servoy.com/reference/servoyextensions/browser-plugins/ngdesktop-utils.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
