Package Exports
- easyqrcodejs-nodejs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (easyqrcodejs-nodejs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
EasyQRCodeJS-NodeJS
EasyQRCodeJS-NodeJS is a NodeJS server side QRCode image generator. Support setting Dot style, Logo, Background image, Colorful, Title and more.
EasyQRCodeJS-NodeJS 是一个 NodeJS 环境下的服务端 JavaScript QRCode 图片生成模块。支持点状风格,Logo,背景图片,规则色彩控制,标题等设置。
Choose what you need
| Project | Support |
|---|---|
| EasyQRCodeJS | Running with DOM on CLIENT-SIDE . Browser(IE6+, Chrome, Firefox, Safari, Opera, Mobile Safari, Android, Windows Mobile, ETC.), Electron, NW.js, ETC. |
| EasyQRCodeJS-NodeJS | Running without DOM on SERVER-SIDE. Save image to file or get data url text. NodeJS, Electron, NW.js, ETC. |
Feature
English
Save QRCode image file without DOM on server side
Support save PNG image file
Support get standard base64 image data url text:
data:image/png;base64, ...Required Patterns that support dot style
Support for Quiet Zone settings
Support custom Position Pattern inner fill and outer border color
Support custom Alignment Pattern inner fill and outer border color
Support custom Timing Patterns vertical, horizontal color
Support Logo images (including transparent PNG images)
Support Background Image
Support for title, subtitle settings
中文
无需 DOM 的服务端 QRCode 图片保存
支持存储为 PNG 图片
支持获得 Base64 编码的标准图形 URL 字符串:
data:image/png;base64, ...支持点形风格的 Required Patterns
支持 Quiet Zone 设置
支持自定义 Position Pattern 内填充和外边框颜色
支持自定义 Alignment Pattern 内填充和外边框颜色
支持自定义 Timing Patterns 垂直,水平颜色
支持 Logo 图片(包括背景透明的 PNG 图片)
支持 Background Image 背景图片
支持标题,副标题设置
Try It!
Demo preview

QR Code Structure

Installation
npm install easyqrcodejs-nodejsBasic Usages
const QRCode = require('easyqrcodejs-nodejs');
// Options
var options = {
text: "www.easyproject.cn/donation"
};
// New instance with options
var qrcode = new QRCode(options);
// Save QRCode image
qrcode.saveImage({
path: 'q.png' // save path
});QRCode API
Object
var qrcode = new QRCode(options);Options
var options = { // ====== Basic text: "https://github.com/ushelp/EasyQRCodeJS", width: 256, height: 256, colorDark : "#000000", colorLight : "#ffffff", correctLevel : QRCode.CorrectLevel.H, // L, M, Q, H dotScale: 1 // Must be greater than 0, less than or equal to 1. default is 1 // ====== Quiet Zone /* quietZone: 0, quietZoneColor: 'transparent', */ // ====== Logo /* logo:"../demo/logo.png", // Relative address, relative to `easy.qrcode.min.js` logo:"http://127.0.0.1:8020/easy-qrcodejs/demo/logo.png", logoWidth:80, // widht. default is automatic width logoHeight:80 // height. default is automatic height logoBackgroundColor:'#fffff', // Logo backgroud color, Invalid when `logBgTransparent` is true; default is '#ffffff' logoBackgroundTransparent:false, // Whether use transparent image, default is false */ // ====== Backgroud Image /* backgroundImage: '', // Background Image backgroundImageAlpha: 1, // Background image transparency, value between 0 and 1. default is 1. autoColor: false, */ // ====== Colorful // === Posotion Pattern(Eye) Color /* PO: '#e1622f', // Global Posotion Outer color. if not set, the defaut is `colorDark` PI: '#aa5b71', // Global Posotion Inner color. if not set, the defaut is `colorDark` PO_TL:'', // Posotion Outer color - Top Left PI_TL:'', // Posotion Inner color - Top Left PO_TR:'', // Posotion Outer color - Top Right PI_TR:'', // Posotion Inner color - Top Right PO_BL:'', // Posotion Outer color - Bottom Left PI_BL:'', // Posotion Inner color - Bottom Left */ // === Alignment Color /* AO: '', // Alignment Outer. if not set, the defaut is `colorDark` AI: '', // Alignment Inner. if not set, the defaut is `colorDark` */ // === Timing Pattern Color /* timing: '#e1622f', // Global Timing color. if not set, the defaut is `colorDark` timing_H: '', // Horizontal timing color timing_V: '', // Vertical timing color */ // ====== Title /* title: 'QR Title', // content titleFont: "bold 18px Arial", //font. default is "bold 16px Arial" titleColor: "#004284", // color. default is "#000" titleBackgroundColor: "#fff", // background color. default is "#fff" titleHeight: 70, // height, including subTitle. default is 0 titleTop: 25, // draws y coordinates. default is 30 */ // ====== SubTitle /* subTitle: 'QR subTitle', // content subTitleFont: "14px Arial", // font. default is "14px Arial" subTitleColor: "#004284", // color. default is "4F4F4F" subTitleTop: 40, // draws y coordinates. default is 0 */ // ===== Event Handler /* onRenderingStart: undefined */ }
Option Required Type Defaults Description Compatibility Basic options --- --- --- --- --- text Y String ''Text width N Number 256Width height N Number 256Height colorDark N String #000000Dark CSS color colorLight N String #ffffffLight CSS color correctLevel N Enum QRCode.CorrectLevel.HQRCode.CorrectLevel.HQRCode.CorrectLevel.Q
QRCode.CorrectLevel.M
QRCode.CorrectLevel.LdotScale N Number 1.0Dot style required Patterns. Ranges: 0-1.0Quiet Zone --- --- --- --- --- quietZone N Number 0Quiet Zone size quietZoneColor N String transparentBackground CSS color to Quiet Zone Logo options --- --- --- --- --- logo N String undefinedLogo Image Path. If use relative address, relative to easy.qrcode.min.jslogoWidth N Number undefinedHeight logoHeight N Number undefinedWidth logoBackgroundTransparent N Boolean falseWhether the background transparent image( PNG) shows transparency. Whentrue,logoBackgroundColoris invalidlogoBackgroundColor N String #ffffffSet Background CSS Color when image background transparent. Valid when logoBackgroundTransparentisfalseBackgroud Image options --- --- --- --- --- backgroundImage N String undefinedBackground Image Path. If use relative address, relative to easy.qrcode.min.jsbackgroundImageAlpha N Number 1.0Background image transparency. Ranges: 0-1.0autoColor N Boolean falseAutomatic color adjustment Posotion Pattern Color options --- --- --- --- --- PO N String undefinedGlobal Posotion Outer CSS color. if not set, the defaut is colorDarkPI N String undefinedGlobal Posotion Inner CSS color. if not set, the defaut is colorDarkPO_TL N String undefinedPosotion Outer CSS color - Top Left PI_TL N String undefinedPosotion Inner CSS color - Top Left PO_TR N String undefinedPosotion Outer CSS color - Top Right PI_TR N String undefinedPosotion Inner CSS color - Top Right PO_BL N String undefinedPosotion Outer CSS color - Bottom Left PI_BL N String undefinedPosotion Inner CSS color - Bottom Left Alignment Color options --- --- --- --- --- AO N String undefinedAlignment Outer CSS color. if not set, the defaut is colorDarkAI N String undefinedAlignment Inner CSS color. if not set, the defaut is colorDarkTiming Pattern Color options --- --- --- --- --- timing N String undefinedGlobal Timing CSS color. if not set, the defaut is colorDarktiming_H N String undefinedHorizontal timing CSS color timing_V N String undefinedVertical timing CSS color Title options --- --- --- --- --- title N String ''titleFont N String bold 16px ArialCSS Font titleColor N String #000000CSS color titleBackgroundColor N String #ffffffCSS color titleHeight N Number 0Title Height, Include subTitle titleTop N Number 30draws y coordinates. SubTitle options --- --- --- --- --- subTitle N String ''subTitleFont N String 14px ArialCSS Font subTitleColor N String #4F4F4FCSS color subTitleTop N Number 0draws y coordinates. default is 0 Event Handler options --- --- --- --- --- onRenderingStart N Function undefinedCallback function when rendering start work. can use to hide loading state or handling.
Method
saveImage(options)
// Save Images to file qrcode.saveImage({ path: 'q.png', // file path compressionLevel: 6 // ZLIB compression level between 0 and 9. default is 6 });
toDataURL()
// Get standard base64 image data url text: 'data:image/png;base64, ...' qrcode.toDataURL().then(data=>{ console.info('======QRCode PNG DataURL======') console.info(data) });
License
MIT License
End
Email:inthinkcolor@gmail.com
Donation/捐助:
我们相信,每个人的点滴贡献,都将是推动产生更多、更好免费开源产品的一大步。
感谢慷慨捐助,以支持服务器运行和鼓励更多社区成员。
We believe that the contribution of each bit by bit, will be driven to produce more and better free and open source products a big step.
Thank you donation to support the server running and encourage more community members.