30 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
/*
 | 
						|
 * This Source Code Form is subject to the terms of the Mozilla Public
 | 
						|
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 | 
						|
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | 
						|
 */
 | 
						|
 | 
						|
 | 
						|
function getAddressQRCode() {
 | 
						|
    var qrstring = $("#addresscodeform #name").val() + "\t"
 | 
						|
            + $("#addresscodeform #company").val() + "\t"
 | 
						|
            + $("#addresscodeform #street1").val() + "\t"
 | 
						|
            + $("#addresscodeform #street2").val() + "\t"
 | 
						|
            + $("#addresscodeform #city").val() + "\t"
 | 
						|
            + $("#addresscodeform #state").val() + "\t"
 | 
						|
            + $("#addresscodeform #zip").val();
 | 
						|
 | 
						|
    var canvas = document.createElement('canvas');
 | 
						|
 | 
						|
    bwipjs.toCanvas(canvas, {
 | 
						|
        bcid: 'qrcode', // Barcode type
 | 
						|
        text: qrstring, // Text to encode
 | 
						|
        scale: 5, // 3x scaling factor
 | 
						|
        includetext: false, // Show human-readable text
 | 
						|
        textxalign: 'center', // Always good to set this
 | 
						|
        eclevel: 'M'
 | 
						|
    });
 | 
						|
    document.getElementById("addresscode-barcode").src = canvas.toDataURL('image/png');
 | 
						|
 | 
						|
    app.popup.create({el: document.getElementById("addresscode-popup")}).open();
 | 
						|
} |