[reportlab-users] Fwd: [reportlab-team] Fwd: PDF Imaging
ramas at live.co.uk
Tue May 20 09:07:06 EDT 2014
It worked very well, Thanks for your help and time.
Date: Tue, 20 May 2014 13:37:13 +0100
From: robin at reportlab.com
To: reportlab-users at reportlab.com
Subject: [reportlab-users] Fwd: [reportlab-team] Fwd: PDF Imaging
1) you are trying to mix platypus flowables (the Image object im) with direct
drawing to the canvas.
The simplest way to do what you want is probably to use either of the canvas
methods drawInlineImage or drawImage.
> HI Nick,
> Good Morning...
> *My code to get image into PDF file,*
> from reportlab.pdfgen import canvas
> from reportlab.lib.pagesizes import letter, A4, landscape
> from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image
> from reportlab.graphics.shapes import *
> from reportlab.lib import colors
> from reportlab.graphics import renderPDF
> from reportlab.lib.enums import TA_CENTER
> from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
> from reportlab.lib.units import cm, inch
> def hello(c):
> c.setFont('Times-Roman', 26)
> c.drawString(100,800, "V-LIFE Monthly Report (May 2014)")
> c.rect(10, 10, 575, 820)
> im = Image("CompanyLogo.jpg")
> im.hAlign = 'CENTER'
this is a platypus object, you can use it with a canvas if you are knowledgeable
about the Flowable api. However, the easiest way to get an image onto a canvas
is to use something like
see reportlab/pdfgen/canvas.py for more details of the available arguments.
> print('Sucessfully done')
> c = canvas.Canvas("testPage.pdf")
reportlab-users mailing list
reportlab-users at lists2.reportlab.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the reportlab-users