render.py 文件源码

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

项目:eClaire 作者: kogan 项目源码 文件源码
def print_card(pdf, printer_name):
    """
    Send the PDF to the printer!

    Shells out to `lpr` to do the work.

    :param pdf: Binary PDF buffer
    :param printer_name: Name of the printer on the system (ie. CUPS name)
    """
    process = subprocess.Popen(
        ['lpr', '-P', printer_name],
        stdin=subprocess.PIPE
    )

    process.communicate(pdf)

    if process.returncode != 0:
        raise PrintingError('Return code {}'.format(process.returncode))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号