Added logic to generate barcodes and generate a PDF with them all. Included free barcode fonts. Also added gitignore file.
This commit is contained in:
48
test.py
48
test.py
@@ -1,10 +1,46 @@
|
||||
from isbnlib import meta
|
||||
# from isbnlib import meta
|
||||
|
||||
# isbn = '9780747532743'
|
||||
# infowiki = meta(isbn, service='wiki')
|
||||
# infoopenl = meta(isbn, service='openl')
|
||||
# print(infowiki)
|
||||
# print(infoopenl)
|
||||
|
||||
isbn = '9780747532743'
|
||||
infowiki = meta(isbn, service='wiki')
|
||||
infoopenl = meta(isbn, service='openl')
|
||||
from fpdf import FPDF
|
||||
|
||||
code = 'Location:1'
|
||||
test = {'CheckIn': 'Check In', 'CheckOut': 'Check Out', 'test': 'testing'}
|
||||
|
||||
print(infowiki)
|
||||
print(infoopenl)
|
||||
pdf = FPDF()
|
||||
pdf.add_font('barcode', '', '.\\static\\barcodeFont\\LibreBarcode128-Regular.ttf', uni=True)
|
||||
pdf.add_page()
|
||||
|
||||
for each in test:
|
||||
pdf.set_font('barcode', '', 25)
|
||||
pdf.cell(0, 5, each)
|
||||
w = pdf.get_string_width(each)
|
||||
pdf.ln()
|
||||
pdf.set_font('Arial', '', 5)
|
||||
pdf.cell(w, 5, test[each], align='C')
|
||||
pdf.ln()
|
||||
pdf.ln()
|
||||
#
|
||||
# pdf.set_font('barcode', size = 24)
|
||||
# pdf.cell(0,10,txt="CheckIn", ln=2, align='C')
|
||||
#
|
||||
# pdf.set_font('Arial', size = 3)
|
||||
# pdf.cell(0,1,txt="Check In", ln=1, align='C')
|
||||
#
|
||||
# pdf.set_font('barcode', size = 24)
|
||||
# pdf.cell(0,10,txt="CheckOut", ln=2, align='C')
|
||||
#
|
||||
# pdf.set_font('Arial', size = 3)
|
||||
# pdf.cell(0,1,txt="Check Out", ln=1, align='C')
|
||||
#
|
||||
# pdf.set_font('barcode', size = 24)
|
||||
# pdf.cell(0,10,txt="Location:1", ln=2, align='C')
|
||||
#
|
||||
# pdf.set_font('Arial', size = 3)
|
||||
# pdf.cell(0,1,txt="Location: 1", ln=1, align='C')
|
||||
|
||||
pdf.output(name='.\\static\\barcodes.pdf')
|
||||
Reference in New Issue
Block a user