Created
July 25, 2019 08:35
-
-
Save ThomasJunk/7329f194b1921649244ce26d5f33195c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pixelsPerMapMillimeter = resolution / 25.4; // resolution = resolution to print at | |
const mapSizeForPrint = [ | |
Math.round(this.pdf.width * pixelsPerMapMillimeter), // 210 * resolution / DPI | |
Math.round(this.pdf.height * pixelsPerMapMillimeter) | |
]; | |
... | |
const scale = 100 | |
map.setSize(mapSizeForPrint); | |
const view = map.getView(); | |
const proj = view.getProjection(); | |
const resolutionForPrint = | |
(getPointResolution(proj, scale, view.getCenter()) / (10 * pixelsPerMapMillimeter)) * proj.getMetersPerUnit(); | |
map.getView().setResolution(resolutionForPrint); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment