{"id":19881392,"url":"https://github.com/giscience/ol-print-layout-control","last_synced_at":"2025-05-02T14:30:34.501Z","repository":{"id":61629770,"uuid":"543484025","full_name":"GIScience/ol-print-layout-control","owner":"GIScience","description":"An extension of openlayers Control. It Helps the user to define a map area that fits to the desired output page format and orientation.","archived":false,"fork":false,"pushed_at":"2022-10-31T12:17:08.000Z","size":485,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-17T06:45:11.834Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GIScience.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-09-30T07:39:12.000Z","updated_at":"2024-11-04T18:05:40.000Z","dependencies_parsed_at":"2023-01-20T16:30:18.907Z","dependency_job_id":null,"html_url":"https://github.com/GIScience/ol-print-layout-control","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GIScience%2Fol-print-layout-control","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GIScience%2Fol-print-layout-control/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GIScience%2Fol-print-layout-control/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GIScience%2Fol-print-layout-control/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GIScience","download_url":"https://codeload.github.com/GIScience/ol-print-layout-control/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252053759,"owners_count":21687161,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T17:14:05.260Z","updated_at":"2025-05-02T14:30:34.083Z","avatar_url":"https://github.com/GIScience.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![status: experimental](https://github.com/GIScience/badges/raw/master/status/experimental.svg)](https://github.com/GIScience/badges#experimental)\n\n# ol-print-layout-control\n\nAdd this OpenLayers-Control to your OpenLayers-Map.\n\nIt Helps the user to define a map area that fits to the desired output page format and orientation.\n\nWorks with ol@^7.0.0.\n\nhttps://user-images.githubusercontent.com/2814068/195790425-99978d1a-6619-47a9-93b5-8c642664af5e.mp4\n\n# Usage\n\n## Browser\n\nLoad `ol-print-layout-control.js` after OpenLayers.\n\nIt will be available as `new ol.control.PrintLayout()`\n\n```html\n\u003cscript src=\"https://unpkg.com/@giscience/ol-print-layout-control\"\u003e\u003c/script\u003e\n\u003clink rel=\"stylesheet\" href=\"https://unpkg.com/@giscience/ol-print-layout-control/dist/ol-print-layout-control.css\" /\u003e\n\n\u003cscript\u003e\nconst map = new ol.Map({\n    target: 'map',\n    view: new ol.View({\n        center: ol.proj.fromLonLat([8.68, 49.41]),\n        zoom: 15\n    }),\n    layers: [\n        new ol.layer.Tile({\n            source: new ol.source.OSM()\n        })\n    ]\n});\n\nconst printLayoutControl = new ol.control.PrintLayout({\n    format: PAPER_FORMAT.A3,\n    orientation: ORIENTATION.LANDSCAPE,\n    margin: {top: 2, bottom: 2, left: 2, right: 2}\n});\nmap.addControl(printLayoutControl);\n\u003c/script\u003e\n```\n\n## Typescript and bundlers\n\nInstall the npm package: [@giscience/ol-print-layout-control](https://www.npmjs.com/package/@giscience/ol-print-layout-control)\n\nAfter `import` from the module it will be available as `new PrintLayout()`.\n\n    npm install @giscience/ol-print-layout-control\n\n# Docs\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### Table of Contents\n\n*   [PrintLayout](#printlayout)\n    *   [Parameters](#parameters)\n    *   [getOrientation](#getorientation)\n    *   [setOrientation](#setorientation)\n        *   [Parameters](#parameters-1)\n    *   [getFormat](#getformat)\n    *   [setFormat](#setformat)\n        *   [Parameters](#parameters-2)\n    *   [getMargin](#getmargin)\n    *   [setMargin](#setmargin)\n        *   [Parameters](#parameters-3)\n    *   [getBbox](#getbbox)\n    *   [getBboxAsLonLat](#getbboxaslonlat)\n    *   [getScaleDenominator](#getscaledenominator)\n    *   [getPrintBoxSizeInDots](#getprintboxsizeindots)\n        *   [Parameters](#parameters-4)\n    *   [getPrintBoxSizeInMM](#getprintboxsizeinmm)\n*   [MarginProps](#marginprops)\n    *   [Properties](#properties)\n*   [Margin](#margin)\n    *   [Parameters](#parameters-5)\n    *   [getProperties](#getproperties)\n    *   [getTop](#gettop)\n    *   [setTop](#settop)\n        *   [Parameters](#parameters-6)\n    *   [getBottom](#getbottom)\n    *   [setBottom](#setbottom)\n        *   [Parameters](#parameters-7)\n    *   [getLeft](#getleft)\n    *   [setLeft](#setleft)\n        *   [Parameters](#parameters-8)\n    *   [getRight](#getright)\n    *   [setRight](#setright)\n        *   [Parameters](#parameters-9)\n\n## PrintLayout\n\n**Extends Control**\n\nThe print-layout-control.\nAdd an instance of this to your OpenLayers Map.\n\n### Parameters\n\n*   `opt_options` **Options**  (optional, default `{}`)\n*   `Options`  {format: 'A4', orientation: 'portrait', margin: {top: 2, bottom: 2, left: 2, right: 2}}] opt\\_options\n\n### getOrientation\n\n### setOrientation\n\n#### Parameters\n\n*   `orientation` **ORIENTATION**\u0026#x20;\n\n### getFormat\n\n### setFormat\n\n#### Parameters\n\n*   `format` **any**\u0026#x20;\n\n### getMargin\n\nReturns **[Margin](#margin)**\u0026#x20;\n\n### setMargin\n\n#### Parameters\n\n*   `margin` **[Margin](#margin)**\u0026#x20;\n\n### getBbox\n\n### getBboxAsLonLat\n\n### getScaleDenominator\n\nComputes the scale denominator for the printed map\n\n### getPrintBoxSizeInDots\n\nGet the print box size (width, height) in dots (px) for printing.\n\nThis is useful to determine the OGC-WMS params 'WIDTH' and 'HEIGHT'\n\n#### Parameters\n\n*   `dpi`  {number} the desired print resolution in dots-per-inch (dpi) (optional, default `192`)\n\nReturns **{width: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), height: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)}**\u0026#x20;\n\n### getPrintBoxSizeInMM\n\n## MarginProps\n\nType: {top: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), bottom: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), left: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), right: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)}\n\n### Properties\n\n*   `top` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n*   `bottom` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n*   `left` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n*   `right` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n## Margin\n\n**Extends OlObject**\n\nThe Margin Class to set paper margins in cm.\n\n### Parameters\n\n*   `marginProps` **Partial\u003c[MarginProps](#marginprops)\u003e**  (optional, default `{}`)\n\n### getProperties\n\nReturns **[MarginProps](#marginprops)**\u0026#x20;\n\n### getTop\n\n### setTop\n\n#### Parameters\n\n*   `topMarginInCm` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n### getBottom\n\n### setBottom\n\n#### Parameters\n\n*   `bottomMarginInCm` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n### getLeft\n\n### setLeft\n\n#### Parameters\n\n*   `leftMarginInCm` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n### getRight\n\n### setRight\n\n#### Parameters\n\n*   `rightMarginInCm` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n# Related\n\nOriginally `ol-print-layout-control` has been developed for the\n[SketchMapTool](https://github.com/GIScience/sketch-map-tool).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiscience%2Fol-print-layout-control","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgiscience%2Fol-print-layout-control","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiscience%2Fol-print-layout-control/lists"}