changes from michael

master
Michael Murtaugh 5 years ago
parent 2a0f3d1112
commit 7095e2df3e

@ -1,9 +1,12 @@
from reportlab.lib.pagesizes import letter, A4
from reportlab.lib.pagesizes import *
from reportlab.pdfgen import canvas
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, PageBreak
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from calibrestekje import Book, Publisher, init_session
doc = SimpleDocTemplate("text.pdf", pagesize=A4,
pagewidth, pageheight = landscape(A6)
doc = SimpleDocTemplate("text.pdf", pagesize=landscape(A6),
rightMargin=72, leftMargin=72,
topMargin=72, bottomMargin=18)
@ -11,9 +14,17 @@ doc = SimpleDocTemplate("text.pdf", pagesize=A4,
content = []
styles = getSampleStyleSheet()
for i in range(10):
p = Paragraph('<font size=12>{}</font>'.format(i), styles["Normal"])
session = init_session("sqlite:///metadata.db")
# publisher = (session.query(Publisher)
# .filter(Publisher.name == "MIT Press").one())
for book in session.query(Book).all():
print (book.title)
# c.drawString(10,pageheight-10, book.title)
# c.showPage()
p = Paragraph('<font size=12>{}</font>'.format(book.title), styles["Normal"])
content.append(p)
content.append(Spacer(1, 12))
# content.append(Spacer(1, 12))
content.append(PageBreak())
doc.build(content)

Loading…
Cancel
Save