adding the files for printing the envelopes
parent
9f8e49a90d
commit
c1eb1e6bec
Binary file not shown.
|
Binary file not shown.
@ -0,0 +1,44 @@
|
||||
from urllib import request
|
||||
import csv
|
||||
import jinja2
|
||||
|
||||
# pad = "https://pad.xpub.nl/p/XPUB-promo-strategies.addresses/export/txt"
|
||||
# addresses = request.urlopen(pad).read().decode()
|
||||
# print(addresses)
|
||||
# with open("addresses.csv", "w") as out:
|
||||
# out.write(addresses)
|
||||
# print("saved: addresses.csv")
|
||||
|
||||
db = {}
|
||||
|
||||
with open("addresses.csv", newline="\n") as csvfile:
|
||||
addresses = csv.reader(csvfile, delimiter=',', quotechar='"')
|
||||
print("opened: addresses.csv")
|
||||
for x, entry in enumerate(addresses):
|
||||
friends = entry[0].strip()
|
||||
school = entry[1].strip()
|
||||
contactperson = entry[2].strip()
|
||||
street = entry[3].strip()
|
||||
postcode = entry[4].strip()
|
||||
city = entry[5].strip()
|
||||
country = entry[6].strip()
|
||||
|
||||
print("added:", school)
|
||||
|
||||
db[x] = {}
|
||||
db[x]["friends"] = friends
|
||||
db[x]["name"] = school
|
||||
db[x]["contactperson"] = contactperson
|
||||
db[x]["street"] = street
|
||||
db[x]["postcode"] = postcode
|
||||
db[x]["city"] = city
|
||||
db[x]["country"] = country
|
||||
|
||||
env = jinja2.Environment(loader=jinja2.FileSystemLoader("."))
|
||||
template = env.get_template("template.html")
|
||||
html = template.render(db=db)
|
||||
|
||||
output = open("addresses.html", "w")
|
||||
output.write(html)
|
||||
output.close()
|
||||
print("saved: addresses.html (open it with a local server running!)")
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,35 @@
|
||||
@page{
|
||||
size: 229mm 162mm;
|
||||
margin: 5mm;
|
||||
}
|
||||
section.envelope{
|
||||
font-family: "unifont";
|
||||
font-size: 24px;
|
||||
display: block;
|
||||
margin: 50mm auto;
|
||||
width: 135mm;
|
||||
break-after: always;
|
||||
line-height: 1.5;
|
||||
}
|
||||
section#xpub{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 70mm;
|
||||
font-family: "header";
|
||||
font-size: 32px;
|
||||
}
|
||||
em{
|
||||
font-family: "italic";
|
||||
font-size: 20px;
|
||||
line-height: 1;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
@font-face{
|
||||
font-family: "header";
|
||||
src:url("komika.woff");
|
||||
}
|
||||
@font-face{
|
||||
font-family: "italic";
|
||||
src:url("LibreBaskerville-Italic.ttf");
|
||||
font-style: italic;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<meta charset="utf-8">
|
||||
<script src="paged.js/paged.polyfill.js"></script>
|
||||
<link href="paged.js/pagedjs.css" rel="stylesheet" type="text/css">
|
||||
<link rel="stylesheet" type="text/css" href="print.css">
|
||||
</head>
|
||||
<body>
|
||||
{% for _, school in db.items() %}
|
||||
<section class="envelope">
|
||||
<section id="xpub">XPUB.NL</section>
|
||||
<div>{{ school.name }}</div>
|
||||
{% if school.contactperson | length > 1 %}
|
||||
<div><em>for {{ school.contactperson }}</em></div>
|
||||
{% endif %}
|
||||
<div>{{ school.street }}</div>
|
||||
<div>{{ school.postcode }} {{ school.city }} ({{ school.country }})</div>
|
||||
</section>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue