[reportlab-users] Scaled Flowables consuming too much space in Platypus?
Dinu Gherman
reportlab-users@reportlab.com
Mon, 16 Sep 2002 12:23:02 +0200
--Apple-Mail-12-177491541
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
Hi,
I'm finding that while Drawings behave as Flowables (as advertised),
they do not "free" space in a story after scaling them down. Should
this be considered a bug or a feature? Please see attached files!
I'm aware about possible intricacies with bounding boxes when
applying arbitrary transformations, but I'd advocate that for the
outmost Drawing "area" it should be possible to calculate the new
(rectangular) bbox and use it in Platypus, too.
Dinu
--Apple-Mail-12-177491541
Content-Disposition: attachment;
filename=scalingbug.py
Content-Transfer-Encoding: 7bit
Content-Type: application/text;
x-unix-mode=0644;
x-mac-type=54455854;
name="scalingbug.py"
# scalingbug.py
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.platypus.doctemplate import SimpleDocTemplate
from reportlab.platypus.paragraph import Paragraph
from reportlab.platypus.flowables import Spacer
from reportlab.graphics.shapes import Drawing, Rect
h2 = getSampleStyleSheet()['Heading1']
w, h = 100, 100
rect = Rect(0, 0, w, h, fillColor=colors.black)
d1 = Drawing(w, h)
d1.add(rect)
d2 = Drawing(w, h)
d2.add(rect)
d2.scale(0.5, 0.5)
story = []
t = "Drawing not scaled - ok!"
story.append(Paragraph(t, h2))
story.append(d1)
story.append(Spacer(0, 100))
t = "Drawing scaled, but flowable area <i>not</i> scaled - not ok?"
story.append(Paragraph(t, h2))
story.append(d2)
SimpleDocTemplate('scalingbug.pdf').build(story)
--Apple-Mail-12-177491541
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
--Apple-Mail-12-177491541
Content-Disposition: inline;
filename=scalingbug.pdf
Content-Transfer-Encoding: quoted-printable
Content-Type: application/pdf;
x-unix-mode=0644;
name="scalingbug.pdf"
%PDF-1.3=0D=0A%=93=8C=8B=9E=20ReportLab=20Generated=20PDF=20document=20=
http://www.reportlab.com=0D=0A%=20'BasicFonts'=20=
'<reportlab.pdfbase.pdfdoc.PDFDictionary=20instance=20a'=20=0D=0A1=200=20=
obj=0D=0A%=20The=20standard=20fonts=20dictionary=0D=0A<<=20/F1=202=200=20=
R=0D=0A=20/F2=203=200=20R=0D=0A=20/F3=204=200=20R=0D=0A=20/F4=205=200=20=
R=20>>=0D=0Aendobj=0D=0A%=20'F1'=20=
'<reportlab.pdfbase.pdfdoc.PDFType1Font=20instance=20at'=20=0D=0A2=200=20=
obj=0D=0A%=20Font=20Helvetica=0D=0A<<=20/BaseFont=20/Helvetica=0D=0A=20=
/Encoding=20/MacRomanEncoding=0D=0A=20/Name=20/F1=0D=0A=20/Subtype=20=
/Type1=0D=0A=20/Type=20/Font=20>>=0D=0Aendobj=0D=0A%=20'F2'=20=
'<reportlab.pdfbase.pdfdoc.PDFType1Font=20instance=20at'=20=0D=0A3=200=20=
obj=0D=0A%=20Font=20Times-Bold=0D=0A<<=20/BaseFont=20/Times-Bold=0D=0A=20=
/Encoding=20/MacRomanEncoding=0D=0A=20/Name=20/F2=0D=0A=20/Subtype=20=
/Type1=0D=0A=20/Type=20/Font=20>>=0D=0Aendobj=0D=0A%=20'F3'=20=
'<reportlab.pdfbase.pdfdoc.PDFType1Font=20instance=20at'=20=0D=0A4=200=20=
obj=0D=0A%=20Font=20Times-Roman=0D=0A<<=20/BaseFont=20/Times-Roman=0D=0A=20=
/Encoding=20/MacRomanEncoding=0D=0A=20/Name=20/F3=0D=0A=20/Subtype=20=
/Type1=0D=0A=20/Type=20/Font=20>>=0D=0Aendobj=0D=0A%=20'F4'=20=
'<reportlab.pdfbase.pdfdoc.PDFType1Font=20instance=20at'=20=0D=0A5=200=20=
obj=0D=0A%=20Font=20Times-BoldItalic=0D=0A<<=20/BaseFont=20=
/Times-BoldItalic=0D=0A=20/Encoding=20/MacRomanEncoding=0D=0A=20/Name=20=
/F4=0D=0A=20/Subtype=20/Type1=0D=0A=20/Type=20/Font=20>>=0D=0Aendobj=0D=0A=
%=20'Page1'=20'<reportlab.pdfbase.pdfdoc.PDFPage=20instance=20at=200x6f'=20=
=0D=0A6=200=20obj=0D=0A%=20Page=20dictionary=0D=0A<<=20/Contents=2010=20=
0=20R=0D=0A=20/MediaBox=20[=200=0D=0A=20=200=0D=0A=20=20595.275590551=0D=0A=
=20=20841.88976378=20]=0D=0A=20/Parent=209=200=20R=0D=0A=20/Resources=20=
<<=20/Font=201=200=20R=0D=0A=20=20/ProcSet=20[=20/PDF=0D=0A=20=20=20=
/Text=0D=0A=20=20=20/ImageB=0D=0A=20=20=20/ImageC=0D=0A=20=20=20/ImageI=20=
]=20>>=0D=0A=20/Trans=20<<=20=20>>=0D=0A=20/Type=20/Page=20>>=0D=0A=
endobj=0D=0A%=20'R7'=20'<reportlab.pdfbase.pdfdoc.PDFCatalog=20instance=20=
at=200'=20=0D=0A7=200=20obj=0D=0A%=20Document=20Root=0D=0A<<=20/Outlines=20=
11=200=20R=0D=0A=20/PageMode=20/UseNone=0D=0A=20/Pages=209=200=20R=0D=0A=20=
/Type=20/Catalog=20>>=0D=0Aendobj=0D=0A%=20'R8'=20=
'<reportlab.pdfbase.pdfdoc.PDFInfo=20instance=20at=200x65'=20=0D=0A8=200=20=
obj=0D=0A<<=20/Author=20(anonymous)=0D=0A=20/CreationDate=20=
(20020916121107)=0D=0A=20/Producer=20(ReportLab=20=
http://www.reportlab.com)=0D=0A=20/Subject=20(unspecified)=0D=0A=20=
/Title=20(untitled)=20>>=0D=0Aendobj=0D=0A%=20'R9'=20=
'<reportlab.pdfbase.pdfdoc.PDFPages=20instance=20at=200x6'=20=0D=0A9=200=20=
obj=0D=0A%=20page=20tree=0D=0A<<=20/Count=201=0D=0A=20/Kids=20[=206=200=20=
R=20]=0D=0A=20/Type=20/Pages=20>>=0D=0Aendobj=0D=0A%=20'R10'=20=
'<reportlab.pdfbase.pdfdoc.PDFStream=20instance=20at=200x'=20=0D=0A10=20=
0=20obj=0D=0A%=20page=20stream=0D=0A<<=20/Filter=20[=20/ASCII85Decode=0D=0A=
=20=20/FlateDecode=20]=0D=0A=20/Length=20411=20>>=0D=0Astream=0D=0A=
Gb!lZ:JZU.&B4)`I#$ko)hhS/'Khd?MM^RdZa[pVD/!KQ+^tmfhq_:5re];"=0D=0A=
?t(QqaR%4L0ftGJLl8:rEfVZ)'2hXCHk"57#!TpV2iSX&TJfY3OB/#QI\7oT=0D=0A=
m3&q0-VW#iqo*<7GJ5d@Tg_WIEYg5.^)%nEW3.Lm>Z\\a@,9m@nXOKYAd>t$=0D=0A=
UEj1)'%u^>*./,X;Uc6Bs(h>MfP@_;T*4=3DL0g">2PZ4l#'hbRlMT%:.G"SbI=0D=0A=
C^975pZk*<\L7?#-["h^\#>e'dN8WurVdJ7V-QKb/'MKs8*-]lH1kSCm#NV^=0D=0A=
a,TWbC"-p^h4"5t*e#!c_ZUcX]H+4OZ6EHt0qpdjTIf&TXBsJ@cM:-k'J4/M=0D=0A=
\L-':T>4Ebq#AZ>`:goLes#srVLiNp"#8jp!!~>endstream=0D=0A=0D=0Aendobj=0D=0A=
%=20'R11'=20'<reportlab.pdfbase.pdfdoc.PDFOutlines=20instance=20at=20'=20=
=0D=0A11=200=20obj=0D=0A<<=20/Count=200=0D=0A=20/Type=20/Outlines=20>>=0D=
=0Aendobj=0D=0Axref=0D=0A0=2012=0D=0A0000000000=2065535=20f=0D=0A=
0000000145=2000000=20n=0D=0A0000000310=2000000=20n=0D=0A0000000509=20=
00000=20n=0D=0A0000000710=2000000=20n=0D=0A0000000913=2000000=20n=0D=0A=
0000001129=2000000=20n=0D=0A0000001451=2000000=20n=0D=0A0000001624=20=
00000=20n=0D=0A0000001857=2000000=20n=0D=0A0000001999=2000000=20n=0D=0A=
0000002591=2000000=20n=0D=0Atrailer=0D=0A<<=20/ID=20=0D=0A=20=20%=20=
ReportLab=20generated=20PDF=20document=20--=20digest=20=
(http://www.reportlab.com)=20=0D=0A=20=20=
[(\244\354\270c>\315\334\214\344\(1\326\245>9\302)=20=
(\244\354\270c>\315\334\214\344\(1\326\245>9\302)]=20=0D=0A=20=0D=0A=20=
/Info=208=200=20R=0D=0A=20/Root=207=200=20R=0D=0A=20/Size=2012=20>>=0D=0A=
startxref=0D=0A2643=0D=0A%%EOF=0D=0A=
--Apple-Mail-12-177491541
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
--
Dinu C. Gherman
......................................................................
"The first principle is that you must not fool yourself - and you are
the easiest person to fool." (Richard Feynman)
--Apple-Mail-12-177491541--