Example #1
0
 def post(self):
     title = self.get_argument('title', 'This is the title')
     circles = int(self.get_argument('circles', 10))
     lines = int(self.get_argument('lines', 10))
     pdf = PDF()
     pdf.start(title, circles, lines)
     pdf.set_title(title)
     filename = pdf.save()
     self.write(filename)
Example #2
0
document.initialize(password)
rsrcmgr = PDFResourceManager()
laparams = LAParams()
device = PDFPageAggregator(rsrcmgr, laparams=laparams)
interpreter = PDFPageInterpreter(rsrcmgr, device)


pdf = PDF(sys.argv[1],verbose=True)

page_no = 1
for page in PDFPage.create_pages(document):
    interpreter.process_page(page)
    # receive the LTPage object for the page.
    layout = device.get_result()
    for group in layout.groups:
        rect = [group.x0,group.y0,group.x1,group.y1]
        quad = [
                group.x0,group.y0,
                group.x1,group.y0,
                group.x1,group.y1,
                group.x0,group.y1
                ]
        pdf.add_annot_to_page(page_no,quad,rect)
    page_no += 1

try:
    pdf.save('annot_test.pdf')
except:
    print "err"
    pass