Class: Print

ol.control. Print

Print control to get an image of the map


new Print( [options])

Parameters:
Name Type Argument Description
options Object <optional>

Control options.

Properties
Name Type Description
className String

class of the control

title String

button title

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

Extends

Methods


copyMap(options, callback)

Helper function to copy result to clipboard

Parameters:
Name Type Description
options any

print options

callback function

a callback function that takes a boolean if copy


fastPrint(options)

Fast print

Parameters:
Name Type Description
options *

print options

Properties
Name Type Argument Description
canvas HTMLCanvasElement | undefined <optional>

if none create one, only for ol@6+


print(options)

Print the map

Parameters:
Name Type Description
options Object
Properties
Name Type Argument Default Description
imageType string

A string indicating the image format, default the control one

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

immediate boolean

true to prevent delay for printing

size boolean <optional>
[210,297]
format boolean <optional>
a4
orient boolean <optional>

default control orientation

margin boolean <optional>
10
any *

any options passed to the print event when fired