new PDF( [options])
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
options |
Mapspace.format.local.PDFOptions |
<optional> |
PDF options. |
- Source:
- mapspace/format/pdf.js
Extends
- ol.Object
Methods
-
addBackground()
-
Adds a background to the PDF.
- Source:
- mapspace/format/pdf.js
-
addCopyright(copyright)
-
Adds a copyright in a footer.
Parameters:
Name Type Description copyrightstring Copyright.
- Source:
- mapspace/format/pdf.js
-
addFieldLogo()
-
Adds Field logo to the PDF.
- Source:
- mapspace/format/pdf.js
Returns:
A promise that adds the Field logo.
- Type
- Promise
-
addHeader(title, date)
-
Adds title and date.
Parameters:
Name Type Argument Description titlestring Title.
datestring <nullable>
Date. Optional. Default is current date.
- Source:
- mapspace/format/pdf.js
-
addMapspaceLogo()
-
Adds Mapspace logo to the PDF.
- Source:
- mapspace/format/pdf.js
Returns:
A promise that adds the Mapspace logo.
- Type
- Promise
-
addPage( [format] [, orientation])
-
Adds (and transfers the focus to) new page to the PDF document.
Parameters:
Name Type Argument Description formatstring <optional>
Format like in
Mapspace.format.local.PDFOptions. Default isa4.orientationstring <optional>
Orientation,
portrait/porlandscape/l. Default isportrait.- Source:
- mapspace/format/pdf.js
-
addScreenShot(canvas, opt)
-
Adds an array of screenshots taken from viewers.
Parameters:
Name Type Argument Description canvasHTMLCanvasElement Canvas with a screenshot.
optObject <nullable>
Optional options. An object with any of the following number properties: x, y, width, max_height; and the string property align that can be 'left', 'right' or 'center'.
- Source:
- mapspace/format/pdf.js
-
addSVGPath(path, color [, location] [, width])
-
Adds a path from an SVG. For now it only converts the following SVG path commands: M/m (move to), H/h (horizontal), V/v (vertical), L/l (line), C/c (Beziers curve), S/s (Smooth curve) and Z/z (close).
Parameters:
Name Type Argument Description pathstring SVG path.
colornumber | Array.<number> | string | undefined If one number (0.0-1.0), a grey color; if array of three numbers (0-255), the RGB; if a string, a hexadecimal. By default is 0.7 grey color.
locationMapspace.Coordinate <optional>
Location x,y.
widthnumber <optional>
Width.
- Source:
- mapspace/format/pdf.js
-
addTable(features, attributes)
-
Adds a table.
Parameters:
Name Type Description featuresArray.<ol.Feature> Features to show in the table.
attributesArray.<Object> Attributes to show in the table.
- Source:
- mapspace/format/pdf.js
-
addTestText()
-
Adds a test page to the PDF.
- Source:
- mapspace/format/pdf.js
-
addViewerInfo(viewer, desc, opt)
-
Adds the info of a viewer.
Parameters:
Name Type Argument Description viewerMapspace.Viewer Viewer.
descstring <nullable>
Optional description.
optObject <nullable>
Optional options. An object with any of the following boolean properties: name, copyright, extent, center, x, y.
- Source:
- mapspace/format/pdf.js
-
getCanvasWidthHeight(canvas, width, max_height)
-
Returns the final height that will be applied when adding a screeshot.
Parameters:
Name Type Description canvasHTMLCanvasElement Canvas.
widthnumber Width to use.
max_heightnumber Maximum height allowed. If height exceeds this then width will be streched.
- Source:
- mapspace/format/pdf.js
Returns:
[width, height]
- Type
- Array.<number>
-
getTextsHeight(texts, width, lineHeightFactor)
-
Returns the expected height when adding some texts. Must be called after setting the font size and before adding the text.
Parameters:
Name Type Argument Description textsArray.<string> Texts.
widthnumber <nullable>
Optional width for the text. Default is the current width of the page minus a margin of 1cm on both sides.
lineHeightFactornumber <nullable>
Optional line height factor. Default is the current line height factor.
- Source:
- mapspace/format/pdf.js
Returns:
- Type
- number
-
writeFile(filename)
-
Writes the PDF to a file.
Parameters:
Name Type Description filenamestring File name.
- Source:
- mapspace/format/pdf.js