Demo Readme Changelog Buy qrcode module

Summary (version 3.0.5)

This module makes it possible to replace an image by an other image

This module is available as part of the docxtemplater ENTREPRISE plan.

Demo

Input Output
Data Code
{
    "image": "examples/firefox.png"
}
const fs = require("fs");
const doc = new Docxtemplater();
const inputZip = new JSZip(docX);
doc.loadZip(inputZip)
	.setData(data);
const qrCodeModule = new QrCodeModule({
	loader: function(tag) {
		return fs.readFileSync(path.resolve(__dirname, "..", "images", tag));
	},
});
doc.attachModule(qrCodeModule);
qrCodeModule.decodeImages(inputZip, () => {
	const output = doc.render().getZip();
});

README

QrCode Module

This module exposes a tag to include qrCode. The qrcode of the pages are parsed, then they are replaced with with the loader function.

Docxtemplater will keep all the styling that you put on your qrcode (shades, effects, size, …).

Installation:

You will need docxtemplater v3: npm install docxtemplater

Install this module with npm install --save "$url"

Usage

Your docx should contain an image that contains a qrcode text. You can use a http://www.qr-code-generator.com/ in Text mode to generate your qrcodes.

Building

You can build the es6 into js by running npm run compile

Testing

npm test

CHANGELOG

3.0.5

  • Do not fail if one image cannot be parsed (EMF files for example)

3.0.4

  • Make it possible to have object in data values, for example :

the qrcode could be decoded to {parameters} and the data is :

{
    "parameters": {"path": "path_to_file.png"}
}

and the loader function will now be called with :

loader({"path": "path_to_file.png"})

before this release, it was called with "" by mistake.

3.0.3

  • Add browserified and minified bundles

3.0.2

  • Use Jimp dependency to allow installation without Python

3.0.1

  • Bugfix when qrCode empty
  • Works with slides modules
  • Works with pptx
  • Works with multiple smartarts

3.0.0

Initial release

Edgar Hipp

I'm the creator of docxtemplater. I work on making docxtemplater great since 2013.