Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

483
Views
Append .png image to a pdf using reportlab in Django framework

I'm using Django and reportlab to generate a PDF report I already can generate the pdf, but I Wanted to append a logo.png to it. these were the lines I added in

views.py:

from reportlab.platypus import Image

logo = Image("/cdss/static/cdss/img/logo.png")

exam.append(logo)

But it isn't working, Am I exporting the Image() method wrong? Or is Path to the file wrong?

Hope you can help me, thanks ;)

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

This Worked For me....

def PrintImage(request,std_id):
    response = HttpResponse(content_type='application/pdf')
    doc = SimpleDocTemplate(response,topMargin=2)

    doc.pagesize = landscape(A6)
    elements = []
    I = Image('http://demoschoolzen.educationzen.com/images/tia.png')
    I.drawHeight =  0.7*inch
    I.drawWidth = 0.7*inch
    elements.append(I)
    doc.build(elements) 
    return response

and Call it from your URLs

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!