Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/zxing-cpp/wrappers/wasm/demo_writer.html @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 | |
| 4 <head> | |
| 5 <meta charset="utf-8"> | |
| 6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| 7 <title>zxing-cpp/wasm writer demo</title> | |
| 8 <link rel="shortcut icon" href="#" /> | |
| 9 <script src="zxing_writer.js"></script> | |
| 10 <script> | |
| 11 var zxing = ZXing().then(function(instance) { | |
| 12 zxing = instance; // this line is supposedly not required but with current emsdk it is :-/ | |
| 13 }); | |
| 14 | |
| 15 function generateBarcode() { | |
| 16 var text = document.getElementById("input_text").value; | |
| 17 var format = document.getElementById("input_format").value; | |
| 18 var charset = document.getElementById("input_charset").value; | |
| 19 var margin = parseInt(document.getElementById("input_margin").value); | |
| 20 var width = parseInt(document.getElementById("input_width").value); | |
| 21 var height = parseInt(document.getElementById("input_height").value); | |
| 22 var eccLevel = parseInt(document.getElementById("input_ecclevel").value); | |
| 23 | |
| 24 var container = document.getElementById("write_result") | |
| 25 var result = zxing.generateBarcode(text, format, charset, margin, width, height, eccLevel); | |
| 26 if (result.image) { | |
| 27 showImage(container, result.image); | |
| 28 } else { | |
| 29 container.innerHTML = '<font color="red">Error: ' + result.error + '</font>'; | |
| 30 container.style.width = '300px'; | |
| 31 } | |
| 32 result.delete(); | |
| 33 } | |
| 34 | |
| 35 function showImage(container, fileData) { | |
| 36 container.innerHTML = ''; | |
| 37 var img = document.createElement("img"); | |
| 38 img.addEventListener('load', function() { | |
| 39 container.style.width = img.width + 'px'; | |
| 40 container.style.height = img.height + 'px'; | |
| 41 }); | |
| 42 img.src = URL.createObjectURL(new Blob([fileData])) | |
| 43 container.appendChild(img); | |
| 44 } | |
| 45 </script> | |
| 46 <style> | |
| 47 #input_text { | |
| 48 width: 240px; | |
| 49 } | |
| 50 | |
| 51 select, | |
| 52 input { | |
| 53 margin: 3px 0px; | |
| 54 width: 120px; | |
| 55 } | |
| 56 | |
| 57 tr td:first-child { | |
| 58 text-align: right; | |
| 59 } | |
| 60 | |
| 61 div { | |
| 62 float: left; | |
| 63 margin: 0.5em; | |
| 64 } | |
| 65 </style> | |
| 66 </head> | |
| 67 | |
| 68 <body> | |
| 69 <h2>zxing-cpp/wasm writer demo</h2> | |
| 70 <p> | |
| 71 This is a simple demo of the wasm wrapper of <a href="https://github.com/zxing-cpp/zxing-cpp">zxing-cpp</a> | |
| 72 for generating barcodes. | |
| 73 </p> | |
| 74 <p></p> | |
| 75 <div> | |
| 76 Enter your text here:<br /> | |
| 77 <textarea id="input_text"></textarea> | |
| 78 <br /> | |
| 79 <table> | |
| 80 <tr> | |
| 81 <td>Format:</td> | |
| 82 <td> | |
| 83 <select id="input_format"> | |
| 84 <option value="Aztec">Aztec</option> | |
| 85 <option value="Codabar">Codabar</option> | |
| 86 <option value="Code39">Code 39</option> | |
| 87 <option value="Code93">Code 93</option> | |
| 88 <option value="Code128">Code 128</option> | |
| 89 <option value="DataMatrix">DataMatrix</option> | |
| 90 <option value="EAN8">EAN-8</option> | |
| 91 <option value="EAN13">EAN-13</option> | |
| 92 <option value="ITF">ITF</option> | |
| 93 <option value="PDF417">PDF417</option> | |
| 94 <option value="QRCode" selected="">QR Code</option> | |
| 95 <option value="UPCA">UPC-A</option> | |
| 96 <option value="UPCE">UPC-E</option> | |
| 97 </select> | |
| 98 </td> | |
| 99 </tr> | |
| 100 <tr> | |
| 101 <td>Encoding:</td> | |
| 102 <td> | |
| 103 <select id="input_charset"> | |
| 104 <option value="Cp437">Cp437</option> | |
| 105 <option value="ISO-8859-1">ISO-8859-1</option> | |
| 106 <option value="ISO-8859-2">ISO-8859-2</option> | |
| 107 <option value="ISO-8859-3">ISO-8859-3</option> | |
| 108 <option value="ISO-8859-4">ISO-8859-4</option> | |
| 109 <option value="ISO-8859-5">ISO-8859-5</option> | |
| 110 <option value="ISO-8859-6">ISO-8859-6</option> | |
| 111 <option value="ISO-8859-7">ISO-8859-7</option> | |
| 112 <option value="ISO-8859-8">ISO-8859-8</option> | |
| 113 <option value="ISO-8859-9">ISO-8859-9</option> | |
| 114 <option value="ISO-8859-10">ISO-8859-10</option> | |
| 115 <option value="ISO-8859-11">ISO-8859-11</option> | |
| 116 <option value="ISO-8859-13">ISO-8859-13</option> | |
| 117 <option value="ISO-8859-14">ISO-8859-14</option> | |
| 118 <option value="ISO-8859-15">ISO-8859-15</option> | |
| 119 <option value="ISO-8859-16">ISO-8859-16</option> | |
| 120 <option value="Shift_JIS">Shift_JIS</option> | |
| 121 <option value="windows-1250">windows-1250</option> | |
| 122 <option value="windows-1251">windows-1251</option> | |
| 123 <option value="windows-1252">windows-1252</option> | |
| 124 <option value="windows-1256">windows-1256</option> | |
| 125 <option value="UTF-16BE">UTF-16BE</option> | |
| 126 <option value="UTF-8" selected="">UTF-8</option> | |
| 127 <option value="ASCII">ASCII</option> | |
| 128 <option value="Big5">Big5</option> | |
| 129 <option value="GB2312">GB2312</option> | |
| 130 <option value="GB18030">GB18030</option> | |
| 131 <option value="EUC-CN">EUC-CN</option> | |
| 132 <option value="GBK">GBK</option> | |
| 133 <option value="EUC-KR">EUC-KR</option> | |
| 134 </select> | |
| 135 </td> | |
| 136 </tr> | |
| 137 <td>ECC Level:</td> | |
| 138 <td> | |
| 139 <select id="input_ecclevel"> | |
| 140 <option value="-1">Default</option> | |
| 141 <option value="0">0</option> | |
| 142 <option value="1">1</option> | |
| 143 <option value="2">2</option> | |
| 144 <option value="3">3</option> | |
| 145 <option value="4">4</option> | |
| 146 <option value="5">5</option> | |
| 147 <option value="6">6</option> | |
| 148 <option value="7">7</option> | |
| 149 <option value="8">8</option> | |
| 150 </select> | |
| 151 </td> | |
| 152 </tr> | |
| 153 <td>Quiet Zone:</td> | |
| 154 <td><input id="input_margin" type="number" value="10" /></td> | |
| 155 </tr> | |
| 156 <td>Image Width:</td> | |
| 157 <td><input id="input_width" type="number" value="200" /></td> | |
| 158 </tr> | |
| 159 <td>Image Height:</td> | |
| 160 <td><input id="input_height" type="number" value="200" /></td> | |
| 161 </tr> | |
| 162 </table> | |
| 163 <br /> | |
| 164 <input type="button" value="Generate" onclick="generateBarcode()" /> | |
| 165 </div> | |
| 166 <div id="write_result"></div> | |
| 167 </body> | |
| 168 | |
| 169 </html> |
