mapprint.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:geo-pyprint 作者: ioda-net 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号