Class: PrintDialog

ol.control. PrintDialog

Print control to get an image of the map


new PrintDialog( [options])

Parameters:
Name Type Argument Description
options Object <optional>

Control options.

Properties
Name Type Argument Default Description
className string

class of the control

title String

button title

lang string <optional>
en

control language, default en

target HTMLElement | string | undefined <optional>

target element to render the control button outside of the map's viewport

targetDialog HTMLElement | string | undefined <optional>

target element for the dialog, default document body

imageType string

A string indicating the image format, default image/jpeg

quality number

Number between 0 and 1 indicating the image quality to use for image formats that use lossy compression such as image/jpeg and image/webp

orientation string

Page orientation (landscape/portrait), default guest the best one

immediate boolean

force print even if render is not complete, default false

openWindow boolean <optional>
false

open the file in a new window on print

copy boolean <optional>
true

add a copy to clipboard select option

save boolean <optional>
true

add a save select option

pdf boolean <optional>
true

add a pdf select option

saveAs function <optional>

a function to save the image as blob

jsPDF * <optional>

jsPDF object to save map as pdf

Extends

Members


_labels

Print dialog labels (for customisation)


formats

List of legeng options * / ol.control.PrintDialog.prototype.legendOptions = { off: 'Hide legend', on: 'Show legend' }; /** List of print image file formats


marginSize

List of margin size


paperSize

List of paper size


scales

List of print scale

Methods


<static> addLang(lang, labels)

Add a new language

Parameters:
Name Type Description
lang string

lang id

labels Objetct

getContentElement()

Get dialog content element

Returns:
Type
Element

getMargin()

Get print margin

Returns:
Type
number

getOrientation()

Get print orientation

Returns:
Type
string

getPage()

Get page element

Returns:
Type
Element

getPrintControl()

Get print control

Returns:
Type
ol.control.Print

getScale()

Get the current map scale factor

Returns:
Type
number

getSize()

Get print size

Returns:
Type
ol.size

getUserElement()

Get dialog user element

Returns:
Type
Element

i18n(what)

Translate

Parameters:
Name Type Description
what string
Returns:
Type
string

isOpen()

Check if the dialog is oprn

Returns:
Type
boolean

print(options)

Show print dialog

Parameters:
Name Type Description
options *
Properties
Name Type Description
size ol/size | string

map size as ol/size or A4, etc.

value number | string

the scale factor or a scale string as 1/xxx

orientation string

landscape or portrait

margin number

setMap(map)

Remove the control from its current map and attach it to the new map. Subclasses may set up event handlers to get notified about changes to the map here.

Parameters:
Name Type Description
map ol.Map

Map.


setMargin(margin)

Set print margin

Parameters:
Name Type Description
margin number

setOrientation(ori)

Set print orientation

Parameters:
Name Type Description
ori string

landscape or portrait


setScale(value)

Set the current scale (will change the scale of the map)

Parameters:
Name Type Description
value number | string

the scale factor or a scale string as 1/xxx


setSize(size)

Set map print size

Parameters:
Name Type Description
size ol/size | string

map size as ol/size or A4, etc.