Is it possible to create a QR code with Firebase?
I'd like to create a QR code for sharing pdf files with other people. It seems the Firebase has such functions but I couldn't figure it out where to generate the code...
Firebase ML-Kit has a barcode scanning API but Firebase does not have a way to create/generate QR codes.
See Firebase ML-Kit: https://firebase.google.com/docs/ml-kit/read-barcodes
Firebase integrates Google Cloud Functions and Cloud Storage. A straightforward way to generate a QR code could be writing a cloud function that takes the input of your call from Firebase, writes the QR code image to your Firebase connected cloud storage, and then returns the URI of the image.
Firebase Cloud Functions "provides a way to extend the behavior of Firebase and integrate Firebase features through the addition of server-side code." source
So, unlike GCP Cloud Functions that can be written in multiple languages, you typically will write Typescript or Javascript only on Firebase Functions.
node.js
// index.js -> bundle.js
var QRCode = require('qrcode')
var canvas = document.getElementById('canvas')
QRCode.toCanvas(canvas, 'sample text', function (error) {
if (error) console.error(error)
console.log('success!');
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.