I am dis-satisfied with solutions which involve a browser since the different rendering engines display different characteristics, and the print engines tend to such to various degrees as well. So, this solution goes directly to .pdf, and also is hoped to be distributable so that interested 'printers/distributors' can be enlisted with relatively little overhead and hassle.
The input file is:
# # This is a yaml file. Comments with # signs are generally OK. # # no-space strint which will be used for output file nameing. # 'None' means that the code will use this file's name to last '.'. #run_name : somethinglike_1-100 run_name : None # Will form URL as {url_com}/{campaign}/{hdat-element} url_dom : http://bitcmp.org campaign: test # file in the 'media' dir, or None in which case it will created # and given a color which is in code. #base_card: None base_card: wwp_2.png # will by system dependant. font_path: /usr/local/share/fonts/TrueType/bkai00mp.ttf # The code has a soft limit of number of sheets to print # which can be overridden here, but also a hard limit # of something like 10 sheets to avoid a run-away. soft_lim_sheets: 4 hdat: - bird-rock - bit-flag - get-ham - piss-ant - vip-dork - pain-ass - wing-nut - zero-fill - damn-zirp - ten-item - lamb-clip - trip-log - the-dude - wall-tick - xray-cup - beer-can - ask-rip - pack-rat - silk-road #- very-last
An example of the output may be found here:
test_1-20_11-19.pdf
The code is 'pure python' but requires 'PyYaml' and 'PIL' to be installed. It also requires 'PyQRNative', but that has no installer so I commited a copy to the ./lib dir. I did the dev work on Python 2.6 under FreeBSD8.2.
Anyone who wishes to make use of the code is welcome to contact me. I'll release it under MIT. I currently have the card image size and all four margins adjustable. Only through trial and error was I able to achieve a card which was close to some example cards I had in size. Many things like the text and QR placement and such may be adjusted, but only by tweaking the code.
Commited to github (first time I've used github or git.)
printer/pub
My hope is that one could check it out from git, add
a background image to the ./media dir, adjust the
./input/test_1-20.yaml file to point to the background image,
then run like so (showing entire run):
user@host ~/co/tvghub/proj/bitcmp/trunk/print/pub> ./printer.py ./input/test_1-20.yaml Computing run lists... Looping over sheets... 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 user@host ~/co/tvghub/proj/bitcmp/trunk/print/pub> ll output/ total 1064 drwxr-xr-x 2 thuppi thuppi 512 Oct 12 01:14 . drwxr-xr-x 6 thuppi thuppi 512 Oct 12 00:38 .. -rw-r--r-- 1 thuppi thuppi 0 Oct 12 01:13 .dummy -rw-r--r-- 1 thuppi thuppi 536445 Oct 12 00:45 test_1-20_1-10.pdf -rw-r--r-- 1 thuppi thuppi 494318 Oct 12 00:45 test_1-20_11-19.pdf