I have been trying all day to get this to work. My complete code is
below. I can get my text into the PDF, I can get my image in the PDF.
What I can't get to work is frames so that the image (logo) appears to
the right of the text. The image always appears first and then the text
below on the next line.
Please help.
Chuck
*************** CUT *************** ********
from reportlab.pdfge n import *
from reportlab.platy pus import *
from reportlab.lib.u nits import inch
from reportlab.platy pus import SimpleDocTempla te
from reportlab.platy pus import flowables
from reportlab.lib.e nums import TA_LEFT, TA_RIGHT, TA_CENTER,
TA_JUSTIFY
from reportlab.lib.p agesizes import letter
#precalculate some basics
top_margin = letter[1] - inch
bottom_margin = inch
left_margin = inch
right_margin = letter[0] - inch
frame_width = right_margin - left_margin
def bill(canvas, doc):
canvas.saveStat e()
canvas.restoreS tate()
def run():
doc = []
from reportlab.lib.s tyles import ParagraphStyle
from reportlab.platy pus import Image
pdf = SimpleDocTempla te('bill2.pdf', pagesize = letter)
#need a style
normal = ParagraphStyle( 'normal')
doc.append(Imag e("pic.jpg", 100, 71)) #Logo
para = Paragraph("Some text1", normal)
doc.append(para )
para = Paragraph("Some text2", normal)
doc.append(para )
para = Paragraph("Some text3", normal)
doc.append(para )
para = Paragraph("Some text4", normal)
doc.append(para )
para = Paragraph(" ", normal)
doc.append(para )
doc.append(HRFl owable(color="b lack", thickness=3, width="100%"))
pdf.build(doc,b ill)
run()
*************** ************ CUT *************** *************** ***** 2 7509
Chuck wrote:
I have been trying all day to get this to work. My complete code is
below. I can get my text into the PDF, I can get my image in the PDF.
What I can't get to work is frames so that the image (logo) appears to
the right of the text. The image always appears first and then the text
below on the next line.
Please help.
you'll get more help at the reportlab users list (see http://two.pairlist.net/pipermail/reportlab-users/ )
Anyhow I got some output from your script, by making two changes
*************** CUT *************** ********
from reportlab.pdfge n import *
...........
>
pdf = SimpleDocTempla te('bill2.pdf', pagesize = letter)
#need a style
normal = ParagraphStyle( 'normal')
doc.append(Imag e("pic.jpg", 100, 71)) #Logo
para = Paragraph("Some text1", normal)
doc.append(para )
para = Paragraph("Some text2", normal)
doc.append(para )
para = Paragraph("Some text3", normal)
doc.append(para )
para = Paragraph("Some text4", normal)
doc.append(para )
para = Paragraph(" ", normal)
doc.append(para )
doc.append(HRFl owable(color="b lack", thickness=3, width="100%"))
change(1)
doc.append(flow ables.HRFlowabl e(color="black" , thickness=3, width="100%"))
>
pdf.build(doc,b ill)
change(2)
pdf.build(doc)
>
run()
*************** ************ CUT *************** *************** *****
I also had to change the name of the image to one on my system.
Hope this helps
--
Robin Becker This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Robin Becker |
last post by:
Version 1.18 of the ReportLab Toolkit has been released.
This release will be the last to attempt to keep compatibility with
Python 1.52 - 2.1. We will allow 2.2 specific features into the code in
future.
There will be a branch called ReportLab_1_18_PRE22. So that enthusiasts
can maintain it if required.
Main changes since ReportLab 1.18:
- Bug & leak fixes.
- improvements to pyRXP which can now be used in 16bit mode.
|
by: Active8 |
last post by:
I did this once and can't remember how <blush> so I read the
reportlab user guid. It says to unzip the reportlab archive - this
is on w2k, BTW, with Python23 - to a directory and make a file
called reportlab.pth in the pythod dir. The only line in this file
is supposed to be the path to the reportlib dir.
Then I'm instructed to open the ... ok I'll close and reopen ... the
python cmd line interpreter and type
import reportlab
|
by: Com Dot |
last post by:
In a frameset, the menu frame has six buttons. I would like to use
mouseOver on these buttons to make images change in another frame.
Does anyone have a script or know of a working site where this is used?
Any help is appreciated.
Thanks,
Com
|
by: Steal |
last post by:
Hi at all
I try to validate this page using the link: http://validator.w3.org/
but it return that this is not a valid HTML 4.01 page
please where is it error?
Steil
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
|
by: AmyMC |
last post by:
Hi, I've been buried in this project, which has a lot of pre-loaded
images. The pages which have these images are frames.... and even with
my best attempts to preload them all still most do not. Some use more
than one image and the flicker is obvious.
Below is how I am loading them, and it doesn't matter if I use URL
referenced images or locally, (i.e. ./image1.gif)
<script>
pic1= new Image;
| |
by: Murray R. Van Luyn |
last post by:
Hi,
Is using frames in a website as big an issue nowadays as it was maybe 5 or
so years ago? I can remember that you used to have to have a frame site, as
well as a non frame site for browsers that didn't support the framed
version. I wonder whether newer browsers have fixed that problem, and I can
now use frames without fear?
Regards,
Murray R. Van Luyn.
|
by: norseman |
last post by:
Daniel de Sousa Barros wrote:
================================================
Click Start/settings/control panel/system/advanced/settings(in \
performance area)/advanced/change
set System managed size on
click SET box to right of above line
click positives (OK APPLY etc.) all way out, system will probably reboot
|
by: Laszlo Nagy |
last post by:
I need to create multi lingual invoices from reportlab. I think it is
possible to use UTF 8 strings but there is a problem with the font. I
could not find any free TTF font that can do latin1, latin2, arabic,
chinese and other languages at the same time. Is there a single font
that is able to handle these languages? (Most of our invoices will be
for EN, FR, DE, HU, SK, CZ, RO but some of them needs to be in Chinese.)
Thanks,
Laszlo
|
by: Robin Becker |
last post by:
Version 2.2 of the ReportLab open-source toolkit is out! You find downloads and
src instructions at http://www.reportlab.org/downloads.html.
Contributions
=============
Thanks to everybody who has contributed to the open-source toolkit in the run-up
to the 2.2 release, whether by reporting bugs, sending patches, or contributing
to the reportlab-users mailing list. Thanks especially to the following people,
who contributed code that has...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |