-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Render with higer image resolution. #379
Comments
The only way we solved a similar problem was to enlarge canvas, ( |
Something like this ?
|
Not with scale. You need real enlargement. |
Like this ?
|
I guess it should work |
It didn't work
Then there still remains to change font sizes wich doesn't seem simple because it's forced in many div's style="...;font-size:14px;...". |
Try working with em. |
@yonatanmn Is there anyway you could provide a simple jsfiddle to illustrate your suggestion? |
@yonatanmn I would like a jsfiddle too, please |
@AdamEdmonds @cristian-dan , can't get html2canvas to work inside jsfiddle, and I don't have time to solve that now. |
@yonatanmn |
@cristian-dan , you are working with canvas, you don't need html2canvas if your html is already canvas! the meaning of this library is to take regular DOM elements and draw them inside canvas as vector elements. In your case you can just draw another canvas after multiplying with JS all the relevant variables |
@yonatanmn yea, but could you show me how to multiply and scale them in the canvas to get better quality? |
@AdamEdmonds : HIGH RESOLUTION EXAMPLE and @cristian-dan - just redraw another canvas, with doubled numbers, and use - canvas.toDataUrl(). |
@yonatanmn Thank you for the High-Res example. That cleared things up for me. |
Fixed in 1.0.0 |
you can use https://github.com/cburgmer/rasterizeHTML.js instead of html2canvas |
Hi,
just wondered to know if there is a way to render a DOM tree in an higher resolution than the actual size of the DOM element themselves.
Let's say I have a div with some text in it:
<div style='width: 100px; height: 100px; border: 1px solid; font-size:12px;'>
some text
</div>
When I do a rendering of this div, the canvas returned will have a size of 100x100 pixels.
If I display a zoomed version of this canvas (for example because the end user uses a zoom factor > 1 in its browser ; because of HiDPI display ; ...) , the result will look pixelized, especially the text.
==> Is there a way to tell html2canvas to render a 'zoomed version' of the same div in a canvas of, let's say 400x400 pixels; the text rendered would have a size of 48px (instead of 12px), the border 4px (instead of 1px), etc...
Note: I saw { width, height } parameters in the options, but obviously it's goal is not to apply a 'zoom' factor, rather to define a canvas size in which the 'un-zoomed' rendering will apply.
Many thanks in advance for your answers & advices.
The text was updated successfully, but these errors were encountered: