def _create_pdf_pdftk(self):
with NamedTemporaryFile(
mode='wb+',
prefix='geo-pyprint_',
delete=True
) as map_image_file:
self._map_image.save(map_image_file, 'PNG')
map_image_file.flush()
# TODO: use the configuration to select the template
# TODO: use the configuration to select the name of the key in the template
pdfjinja = PdfJinja('pdfjinja-template.pdf')
pdfout = pdfjinja(dict(map=map_image_file.name))
with NamedTemporaryFile(
mode='wb+',
prefix='geo-pyprint_',
suffix='.pdf',
delete=False
) as output_file:
pdfout.write(output_file)
output_file.flush()
return output_file.name
评论列表
文章目录