예제 #1
0
파일: web.py 프로젝트: feesta/pdf-generator
 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)
예제 #2
0
파일: miner.py 프로젝트: joeyuan19/PyDF
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