A pandoc filter to insert barcodes and QR codes in a latex/pdf document
The filter is written in Python with panflute which I recommend if you want to create your own pandoc filters.
sudo pip install pandoc-latex-barcode
or
docker run -d daamien/pandoc-latex-barcode
First you need to the following packages to the latex template :
\usepackage{pstricks}
\usepackage{pst-barcode}
For your convenience, here's a complete one based on the pandoc default latex template :
pandoc_latex_barcode.template.tex
To generate a generic barcode:
<div class="barcode">Hello World !</div>
To generate an ISBN barcode:
<div class="barcode isbn">978-3-86541-114</div>
To generate a QR code:
<div class="qrcode">http://www.pandoc.org</div>
pandoc --filter pandoc-latex-barcode \
--template ./pandoc_latex_barcode.template.tex \
--latex-engine xelatex \
./pandoc_latex_barcode.sample.md \
-o ./pandoc_latex_barcode.sample.pdf
Note : The xelatex engine is mandatory because of pstricks.
There's also few parameters you can setup in the document front matter :
barcode: {
barcode_width: '50mm',
barcode_height: '30mm',
qrcode_width: '25mm',
qrcode_height: '25mm' ,
isbn: '123-4-56789-111',
}
-
barcode_width and barcode_height defines the size of the barcode. Default : 50mmx30mm
-
qrcode_width and qrcode_height defines the size of the QR code. Default : 25mmx25mm
-
isbn : overides the value inside the
<div>
Default :None
For more details, please refer to the pst-barcode documentation :
http://texdoc.net/texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.pdf
See pandoc_latex_barcode.sample.md
and pandoc_latex_barcode.sample.pdf
If you have any difficulties with this software, please file an issue here :
https://github.com/daamien/pandoc-latex-barcode/issues
This software is available under the BSD 3-Clause Licence.
see LICENSE