[英]Placing a generated bar code on an image using JavaScript
我正在使用 JsBarcode JavaScript 庫來生成條形碼。 我想將此條形碼放在圖像上的特定位置,然后下載圖像。 我怎樣才能做到這一點?
我將數據存儲在 cloud-firestore 中,然后使用 Document id 生成 128 代碼。 使用 JSBarcode,我可以獲取 id 並生成條形碼,但我不知道如何將該條形碼放置在特定位置的圖像上,然后下載圖像。
對不起,如果我沒有遵守任何 Stackoverflow 規則,因為我是新來的。
這是 html 代碼:
<svg id="barcode"></svg>
JavaScript 代碼:
db.collection("qrcode").add({
category: category_item,
}).then(function (docRef) {
db.collection("qrcode").doc(docRef.id).update({
category: category_item,
collected_by: "-",
date: new firebase.firestore.Timestamp.now().seconds * 1000,
id: docRef.id,
item: item,
status: "Pending",
}).then(function () {
window.alert("Data added successfully!");
}).catch(function (error) {
window.alert("There was some error. Please try again.");
console.log(error.code);
console.log(error.message);
});
JsBarcode("#barcode", docRef.id); //Generating the barcode here
}).catch ...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.