Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement for the printing control #785

Open
14 of 19 tasks
jokd opened this issue Dec 18, 2019 · 10 comments
Open
14 of 19 tasks

Enhancement for the printing control #785

jokd opened this issue Dec 18, 2019 · 10 comments

Comments

@jokd
Copy link
Contributor

jokd commented Dec 18, 2019

It would be nice to:

@tonnyandersson
Copy link
Collaborator

tonnyandersson commented Dec 19, 2019

It is possible to obtain a higher resolution just by passing a scale parameter to html2canvas. It won't make a huge difference, but it gives a noticable bump in overall image quality. As one might expect, increasing the scale has the greatest impact on regular HTML elements like texts and logos, but it will affect the map element as well. See comparison below.

image
Default scale (150% zoom)

image
2x scale (150% zoom)

image
4x scale (150% zoom)

Please note that the difference in the map image quality is slightly (slightly) more distinct in an actual print.

This is a quick and dirty way to achieve a slightly better image quality. However, to obtain a higher resolution on the map element as well, and thus greatly improve the overall export quality, would require a bit more work than just adding a simple parameter.

@jokd
Copy link
Contributor Author

jokd commented Dec 19, 2019

How is file size affected?

@tonnyandersson
Copy link
Collaborator

Quite a bit. At default scale, the export above, originally an A4 PDF, weighs in at 451 kB. At 4x scale, the file size is 2447 kB.

@jokd
Copy link
Contributor Author

jokd commented Dec 19, 2019

I can live with that if the vector features are crispy and clear, are they?
What do 2x looks like?

@tonnyandersson
Copy link
Collaborator

tonnyandersson commented Dec 19, 2019

Added a 2x screenshot to my first comment. 1080 kB as A4 PDF. And no, vector features are not crispy and clear since such features are a part of the map canvas, just like the basemap.

You can tinker with this by adding scale as a parameter to convertHtml2canvas here: https://github.com/origo-map/origo/blob/master/src/utils/download.js#L64

@jokd
Copy link
Contributor Author

jokd commented Dec 19, 2019

4x gets my vote. Could it be an option for the control?
Would be nice to get this in before the release.

@tonnyandersson
Copy link
Collaborator

It's a whole lot faster to just hardcode it. It's a quick fix, a temporary workaround. No point in putting too much time into it. File sizes and export/download times are acceptable, even for A3 exports.

But that's just, like, my opinion.

@jokd
Copy link
Contributor Author

jokd commented Dec 19, 2019

Then I think we should set it to 4x. At least for now.

@jokd
Copy link
Contributor Author

jokd commented Dec 19, 2019

Overlays are rendered poorly:
image
I suggest we either rework the css or close overlays when entering print mode

@tonnyandersson
Copy link
Collaborator

Good point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants