ProgrammerAH

Programmer Guide, Tips and Tutorial

Skip to content
  • Home
  • Python
  • PHP
  • JAVA
  • MySQL
  • Linux
  • JavaScript
  • Privacy Policy

Canvas generates poster todataurl with error [Solved]

WeChat official account H5 page, creating the idea of two-dimensional code posters with parameters.

1. Generate QR code with parameters
use the plug-in phpqrcode, which has been recorded in previous articles. No more details.

2. Generate canvas canvas
draw the poster content through cavans first. Then convert the canvas picture to Base64 encoding using todataurl. Then, copy the base64 encoding to the picture and display it.

var canvas = document.getElementById("myCanvas");
var imgBase64=canvas.toDataURL("image/png");
                var oimg = document.getElementById("img");
                oimg.src=imgBase64;

3. The displayed pictures can be stored by long-pressing save
note: all elements in the canvas need to be loaded, otherwise an error will be reported in todataurl
therefore, crossorigin = “anonymous” should be added to the attributes of all pictures or documents

Read More:

  • Chart.js Error: “Canvas is already in use. Chart …must be destroyed before the canvas can be reused”
  • [How to Solve] canvas.save(Canvas.ALL_SAVE_FLAG)
  • [Solved] Gitee generates public key error: Enter file in which to save the key…
  • IDEA generates Spring Boot project error: error: read timed out
  • [Solved] Unity Publish WebGL Error: Unable to parse Build/webTest2.framework.js.gz
  • error: (-215:Assertion failed) size.width>0 && size.height>0 in function ‘cv::imshow‘
  • [Solved] Labelimg Open an image Error: Error opening file
  • openlayers — Cannot read property ‘slice‘ of null—Map cannot be loaded
  • [Solved] Mac Notebook M1 Chip Install Hashlips library npm error
  • [Solved] Eval Error: Uncaught ReferenceError: False is not defined
  • [Go] Solve the garbled content sent by go-smtp and the unparsed html mail sent
  • Solution to latex “too many unprocessed floats” error
  • Java handles special characters in URL
  • Download and save uniapp pictures to Android error reporting app
  • [Solved] Tensorflow-gpu Error: self._traceback = tf_stack.extract_stack()
  • [Solved] mmdetection yolox Error: find_unused_parameters
  • [Solved] Keil C Error: error C141: syntax error near ‘=‘, expected ‘__asm‘
  • [Solved] error converting to execution character set illegal byte sequence
  • VSCode Terminal Execute tsc Commands Error [Solved]
  • [Vue warn]: Error in render: TypeError: Cannot read property ‘xxxx’of undefined

This entry was posted in Error and tagged es6, front end, javascript, Official account development on 2021-11-23 by Robins.

Post navigation

← Cocoapods Upgrade Error: ffi * * * * [How to Solve] Python server run code ModuleNotFoundError Error [How to Solve] →

Recent Posts

  • MAFIA: 1- OpenFlow statistics (Counters, Timestamps)(mafia-sdn/p4demos/demos/1-openflow/1.1-statistics/p4src/of.p4)
  • LDSC: Could not open Corces_ATAC_1000Gv3_ldscores/Corces_ATAC.1.1.l2.ldscore[./gz/bz2]
  • Gradle Package Project Lombok Not Working: No serializer found for class com.qbb.User and no properties discovered to create BeanSerializer……
  • [Solved] PCH Warning: header stop not at file scope
  • pymysql Error: File “/usr/local/lib/python2.7/site-packages/PyMySQL-1.0.2-py2.7.egg/pymysql/connections.py”, line 167 SyntaxError: invalid syntax

Tags

  • Android
  • Android studio
  • back-end
  • Big data
  • bug
  • c++
  • cents
  • database
  • Deep learning
  • development language
  • docker
  • eclipse
  • error
  • front end
  • git
  • Hadoop
  • idea
  • intellectual idea
  • java
  • javascript
  • linux
  • maven
  • mybatis
  • mysql
  • node.js
  • Npm
  • OpenCV
  • Operation and maintenance
  • php
  • ProgrammerAH
  • python
  • pytorch
  • qt
  • report errors
  • solution
  • spring
  • spring boot
  • SQL
  • tensorflow
  • The database
  • The server
  • tomcat
  • ubuntu
  • View.js
  • windows
Proudly powered by WordPress