pdf_generator.py 文件源码

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

项目:king-phisher-plugins 作者: securestate 项目源码 文件源码
def process_attachment_file(self, input_path, output_path, target=None):
        output_path, _ = os.path.splitext(output_path)
        output_path += '.pdf'

        pdf_file = platypus.SimpleDocTemplate(
            output_path,
            pagesize=letter,
            rightMargin=72,
            leftMargin=72,
            topMargin=72,
            bottomMargin=18
        )

        url = self.application.config['mailer.webserver_url']
        if target is not None:
            url += '?uid=' + target.uid

        try:
            pdf_template = self.get_template(input_path, url)
            pdf_file.multiBuild(pdf_template)
        except Exception as err:
            self.logger.error('failed to build the pdf document', exc_info=True)
            return
        self.logger.info('wrote pdf file to: ' + output_path + ('' if target is None else ' with uid: ' + target.uid))
        return output_path
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号