[reportlab-users] CMYK colours with & > < characters or superscripts in Paragraph

Michael Richdale michael.richdale at enform.co.nz
Sun Oct 30 21:56:36 EST 2005

I am generating a PDF document that contains Paragraphs that are CMYK
but any paragraph that contains &<> or superscript seem to revert back
to RGB, has anyone else come across this? Below is a simple script to
reproduce the problem.
(I am running Python 2.4.1 on FreeBSD and with the latest version of
reportlab checked out of subversion)
from reportlab.pdfgen import canvas
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.platypus import Paragraph, Frame
c = canvas.Canvas( "/tmp/cmyk_test.pdf" )
normalStyle = getSampleStyleSheet()[ 'Normal' ]
normalStyle.fontSize = 7
normalStyle.fontName = "Helvetica"
normalStyle.textColor = colors.CMYKColor( 1, 0.8, 0, 0.1 )
normalStyle.leading = 10
story = [];
story.append( Paragraph( "this is a test, this should be CMYK.",
normalStyle ) )
# any of the following charactors in the paragraph will cause the
colours to get messed up & < > or superscripts
story.append( Paragraph( "this is a test with an &amp;, is this RGB?",
normalStyle ) )
story.append( Paragraph( "are the colours back to normal?", normalStyle
) )
f = Frame( 100, 600, 200, 100, showBoundary=1 )
f.addFromList( story, c )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://two.pairlist.net/pipermail/reportlab-users/attachments/20051031/bbe65189/attachment.html

More information about the reportlab-users mailing list