Closed GoogleCodeExporter closed 9 years ago
Added the code with a web2py example project at
https://github.com/jredrejo/Labels-for-pyfpdf
Original comment by jredr...@gmail.com
on 1 Oct 2011 at 3:41
Yes, your are welcome, thanks!
If you don't broke anything, you can just commit the changes ;-)
Please create a scripts directory for pdflabels.py
A wiki page explaining how it works would be good.
Original comment by reingart@gmail.com
on 3 Oct 2011 at 5:46
Code changes committed in rev 208314825f21
I'll upload an example of use and a wiki page asap.
Original comment by jredr...@gmail.com
on 7 Oct 2011 at 11:55
When I tried to use it, the Avery-5160 did not format correctly. I got it to
work by changing it to:
'Avery-5160':{'paper-size':'letter', 'metric':'mm',
'marginLeft':6.762,'marginTop':12.7,'NX':3,'NY':10,'SpaceX':3.175,'SpaceY':0,
'width':66.675,'height':25.4,'font-size':10}
I believe the marginTop was a typo during inch-mm conversion from the Avery
specs. The marginLeft may have been okay, but all of the labels were left
justified. Not sure if that should be changed in the code or not. The
font-size is a personal preference.
Original comment by schn...@gmail.com
on 21 Jul 2014 at 8:22
I can not confirm it because I don't have that avery paper. I based this on
http://fpdf.de/downloads/addons/29/ . The differences between both values don't
match with a inches-mm conversion error. Now I have found
https://github.com/lsolesen/fpdf/blob/master/examples/label/PDF_Label.php that
adds some improvement to the previous code, but it still keeps the same margin
values.
Is there any source with the right values that we can trust?
Original comment by jredr...@gmail.com
on 23 Jul 2014 at 9:19
This page is the second result when doing a Google search "python avery
labels". So, if someone else comes here wanting a straightforward how-to,
here's what worked for me:
1. pip install fpdf
2. Download
https://raw.githubusercontent.com/jredrejo/Labels-for-pyfpdf/master/pyfpdf/pdfla
bels.py into your working directory.
Example code:
import pdflabels # pity this can't be merged into the fpdf package
pl = pdflabels.PDFLabel('Avery-5160')
pl.add_page()
pl.add_label("%s\n%s\n%s\n%s %s"%("Joe Blow","123 Main St","Anytown","Anystate","XY 12345")
pl.add_label(....)
pl.output('addresslabels.pdf', 'F')
Original comment by phi...@taits.org
on 30 Nov 2014 at 11:51
Original issue reported on code.google.com by
jredr...@gmail.com
on 30 Sep 2011 at 8:03