Skip to content

Instantly share code, notes, and snippets.

@gwpl
Last active January 24, 2016 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gwpl/29c85792fb797068b68f to your computer and use it in GitHub Desktop.
Save gwpl/29c85792fb797068b68f to your computer and use it in GitHub Desktop.
barcodes_labels_test.tex - test of barcodes printing for Emerson 525x25,4mm paper on HP 3525 Ink Advantage. (Before I make repo, let's make it gist. Licence: as it is just LaTeX document, I give it with no warranty to Public Domain, let's use "The Unlicense" license (even more permissive then CC0) following advice on : http://choosealicense.com/…
\documentclass[a4paper,12pt]{article}
\usepackage[newdimens]{labels}
\usepackage[pdf]{pstricks} % is it needed?
\usepackage{pst-barcode}
\usepackage{auto-pst-pdf} % pdflatex require -shell-escape option!!!
%\usepackage[cleanup={},process=all]{pstool}
% Adjustements for Sticky Labels by Emerson (www.emerson.pl)
% model: 52,5mmx25,4mm A4 (Art.038) EAN 5902178074669
%
% Printed on Linux and HP 3525 Ink Advantage
% with margins set to 0mm , duplex off, color black best
\LabelCols=4%
\LabelRows=11%
\LeftPageMargin=2mm%
\RightPageMargin=2mm%
\TopPageMargin=9mm%
\BottomPageMargin=9mm%
\InterLabelColumn=0mm%
\InterLabelRow=0mm%
% These four parameters give the extra space used around the text on
% each actual label.
\LeftLabelBorder=4mm%
\RightLabelBorder=4mm%
\TopLabelBorder=4mm%
\BottomLabelBorder=4mm%
\begin{document}
% labels are 52.5x25.4 mmxmm. As we specified 4mm safety border,
% It gives us 44.5x17.5 mmxmm (WxH) of usable space,
% what is 1.751969x0.6889764 inxin (WxH) (let's use 1.75x0.68 inxin approx)
% Testing of different size options with EAN2
% Characters 0123456789
% Data 2 digits
\numberoflabels=2
\boxedaddresslabel{
\begin{pspicture}%(44.5mm,17.5mm) %I find it optional
\psbarcode{38}{height=0.30 includetext guardwhitespace}{ean2}
\end{pspicture}
}
\numberoflabels=1
\addresslabel{
\begin{pspicture}(44.5mm,17.5mm)
\psbarcode{38}{height=0.30}{ean2}
\end{pspicture}
}
\numberoflabels=1
\boxedaddresslabel{
\begin{pspicture}%(44.5mm,17.5mm)
\psbarcode{38}{height=0.30 width=0.8 includetext guardwhitespace}{ean2}
\end{pspicture}
}
% allowed in code39:
% 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/
\numberoflabels=1
\boxedaddresslabel{
\begin{pspicture}(44.5mm,17.5mm)
\psbarcode{CODE-39}{height=0.33 width=1.4 includecheck includetext}{code39}
\end{pspicture}
}
% Code128 test from manual
\numberoflabels=1
\addresslabel{
\begin{pspicture}%(44.5mm,17.5mm)
\psbarcode{^104^102Count^0991234^101!}{height=0.33 width=1.0 includetext}{code128}
\end{pspicture}
}
% Code128
\numberoflabels=1
\boxedaddresslabel{
\begin{pspicture}%(44.5mm,17.5mm)
\psbarcode{Code128 is Powerfull!}{height=0.28 width=1.4 includetext}{code128}
\end{pspicture}
}
% QR Code
\numberoflabels=1
\boxedaddresslabel{
\begin{pspicture}%(44.5mm,17.5mm)
%TODO: check if newline in QR code is preserved
\psbarcode{QRCode Test!
(Second line)}{height=0.4 width=0.4}{qrcode}
\end{pspicture}
\parbox[b][0.4in][c]{1.0in}{
\tiny{
QRCode Test!
(Second line)
}
}
}
% QR Code
\numberoflabels=1
\addresslabel{
\begin{pspicture}%(22.2mm,17.5mm)
\psbarcode{QRCode Test 0!}{height=0.42 width=0.42}{qrcode}
\end{pspicture}
\begin{pspicture}%(22.2mm,17.5mm)
\psbarcode{QRCode Test 1!}{height=0.42 width=0.42}{qrcode}
\end{pspicture}
\begin{pspicture}%(22.2mm,17.5mm)
\psbarcode{QRCode Test 2!}{height=0.42 width=0.42}{qrcode}
\end{pspicture}
}
%
%
% Some empy to check how, empty works
\numberoflabels=7 % 7 gives always one row empty
\addresslabel{}
% Let's fill rest of page to check aligment
\numberoflabels=28
\boxedaddresslabel{
Test!
}
\end{document}
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org>
.PHONY: all clean cleanup reset
all: barcodes_labels_test.pdf
%.pdf: %.tex
pdflatex -shell-escape "$<"
cleanup:
rm -v *.aux *.log || true
reset: cleanup
rm -v *.pdf || true
clean: reset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment