【问题标题】:How to create text drop shadow in ReportLab?如何在 ReportLab 中创建文本阴影?
【发布时间】:2018-02-14 08:02:32
【问题描述】:

最好使用 ReportLab 的基本 drawString 方法,或者如果没有任何其他可用的 ReportLab 功能,我该如何创建“投影”效果?

我想我可以画两次字符串,但这不会产生非常好的 PDF。 (但是它们是用于打印的,而不是用于计算机消费的,因此它们的字符串是否加倍可能无关紧要。)

【问题讨论】:

    标签: python pdf reportlab


    【解决方案1】:

    似乎唯一的解决方案是使用不同的颜色和在两个方向上偏移 1 个点在彼此的顶部打印两次。

            style.textColor = 'black'
            f = Frame(column + 1, 
                      row - 1,
                      width, 
                      height)    
    
            story = [Paragraph(text, style)]
    
            f.add(KeepInFrame(0, 0, story), canvas)
    
            style.textColor = 'white'
            f = Frame(column, 
                      row,
                      width, 
                      height)    
    
            story = [Paragraph(text, style)]
    
            f.add(KeepInFrame(0, 0, story), canvas)
    

    【讨论】:

    • 我知道这是 OP 试图避免的,但我把它留在这里供其他人使用。
    猜你喜欢
    • 1970-01-01
    • 2018-07-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-24
    • 2011-11-12
    • 1970-01-01
    相关资源
    最近更新 更多