透明图像在PDF(Python)中变为黑色

时间:2012-10-10 12:44:18

标签: python pdf transparency reportlab

  

可能重复:
  Transparency in PNGs with reportlab 2.3

我正在尝试通过reportlab模块以PDF格式编写图像。这非常有效,但每当我尝试插入透明图像时,它都会在PDF页面中变为黑色。任何人都知道如何解决这个问题?

from reportlab.pdfgen.canvas import Canvas
from reportlab.lib.pagesizes import letter
from reportlab.lib.colors import *
from reportlab.lib.units import cm, mm, inch, pica
from reportlab.platypus import SimpleDocTemplate, Table, TableStyle

pdf = Canvas(AnalysisReport.pdf', pagesize = letter)
pdf.setFont("Helvetica-Bold", 45)
pdf.setFillColor('#000000')
pdf.drawCentredString(inch *4.25, inch *10.00, "Qualitative Analysis Report")
pdf.drawInlineImage("\Glycaan8_78974.png", 500, 500)
pdf.showPage()
pdf.save()

0 个答案:

没有答案