def process_pdf(self, image_data, hocr_data, pdf_filename):
"""Utility function if you'd rather get the PDF data back instead of save it automatically."""
pdf = Canvas(pdf_filename, pageCompression=1)
pdf.setCreator('hocr-tools')
pdf.setPageSize((self.width, self.height))
pdf.drawImage(image_data, 0, 0, width=self.width, height=self.height)
pdf = self.add_text_layer(pdf, hocr_data)
pdf_data = pdf.getpdfdata()
return pdf_data
hocrpdf.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录