Exemplo n.º 1
0
 def post(self):
     self.set_header('Content-Type', 'application/pdf; charset="utf-8"')
     self.set_header('Content-Disposition',
                     'attachment; filename="i-589-filled.pdf"')
     data = tornado.escape.json_decode(self.request.body)
     pages = form_constructor(data)
     form = Form(pages)
     output = form.assemble()
     tmp = BytesIO()
     output.write(tmp)
     self.write(tmp.getvalue())
     self.finish()
Exemplo n.º 2
0
    ChildFields(
        "123456", "74280429",
        MaritalStatus.MARRIED, "0123456789", "Reindeer", "Rudolph", "Red Nose",
        date(1932, 12, 25), "North Pole", "Denmark", "None", "Reindeer",
        Gender.FEMALE, True, "North Pole",
        UsEntry(date(2018, 12,
                     25), "New York, NY", "Entered Without Inspection",
                date(2018, 12,
                     25)), "34F66", "Entered Without Inspection", False, True),
    ChildFields(
        "123456", "74280429",
        MaritalStatus.MARRIED, "0123456789", "Reindeer", "Rudolph", "Red Nose",
        date(1932, 12, 25), "North Pole", "Dencanussia", "None", "Reindeer",
        Gender.MALE, True, "North Pole",
        UsEntry(date(2018, 12,
                     25), "New York, NY", "Entered Without Inspection",
                date(2018, 12,
                     25)), "34F66", "Entered Without Inspection", True, False))

page_12 = Page_12(
    "1928374", "Pancho Gonzalez", date(2018, 11, 30), "A.I.", "13",
    "Some text to explain what's going on á, é, í, ó, ú, ü, ñ, ¿, ¡ ひ")
pages = [
    page_1, page_2, page_3, page_4, page_5, page_6, page_7, page_8, page_9,
    page_10, page_11, page_12
]
form = Form(pages)
output = form.assemble()
with open("page-test.pdf", 'wb') as out:
    output.write(out)