Canvas to Save Image and Email

孤街醉人 提交于 2019-12-25 01:47:17

问题


We have a custom product designing tool at "http://dev.ejuicysolutions.com/custom_shirt_designer/". When user will be finished with formatting with text etc... they will click on print button, where they can print but we need to extend functionality from print to "Save Image, as shown in Canvas" and then email that image. Email can be done but the main problem we are facing is that image is being saved on server but all other formatting like text are not being saved along with. Either script is just placing text etc using styles... on above the canvas... Any idea, how it can be achieved?



Thanks in advance!


回答1:


If i understand this right, you need to export the canvas content to an image, in the state it is when the user finished his work? There is an export function inside the canvas. canvas.toDataURL(). That way you get a base64 image, default is png format.




回答2:


Looks like the text is just HTML added on top of the canvas, so it wont get encoded with .toDataURL()

If you are using HTML emails you could save the CSS / HTML and then re-apply it on top of the png (set png as background image)

Or alternativly use canvas text instead of HTML, then it will be part of the .png



来源:https://stackoverflow.com/questions/15990696/canvas-to-save-image-and-email

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!