本文整理汇总了Python中reportlab.pdfgen.canvas.setStrokeColorRGB函数的典型用法代码示例。如果您正苦于以下问题:Python setStrokeColorRGB函数的具体用法?Python setStrokeColorRGB怎么用?Python setStrokeColorRGB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setStrokeColorRGB函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: prepare_first_page
def prepare_first_page(canvas, document):
p1 = Paragraph(presentation.title, styles['Heading'])
p2 = Paragraph(
presentation.owner.get_full_name(), styles['SubHeading'])
avail_width = width - inch
avail_height = height - inch
w1, h1 = p1.wrap(avail_width, avail_height)
w2, h2 = p2.wrap(avail_width, avail_height)
f = Frame(
inch / 2,
inch / 2,
width - inch,
height - inch,
leftPadding=0,
bottomPadding=0,
rightPadding=0,
topPadding=0
)
f.addFromList([p1, p2], canvas)
document.pageTemplate.frames[0].height -= h1 + h2 + inch / 2
document.pageTemplate.frames[1].height -= h1 + h2 + inch / 2
canvas.saveState()
canvas.setStrokeColorRGB(0, 0, 0)
canvas.line(
width / 2, inch / 2, width / 2, height - inch - h1 - h2)
canvas.restoreState()
开发者ID:hanleybrand,项目名称:rooibos,代码行数:28,代码来源:viewers.py
示例2: drawCutlines
def drawCutlines(canvas):
canvas.setStrokeColorRGB(255,0,0)
canvas.circle(6*scale_num,6*scale_num, hole_rad*scale_num/2, stroke=1, fill=0)
canvas.circle(6*scale_num,6*scale_num, diameter*scale_num/2, stroke=1, fill=0)
return canvas
开发者ID:Nehri,项目名称:making-records,代码行数:7,代码来源:laser_cut_generator.py
示例3: myLaterPages
def myLaterPages(canvas, doc):
PAGE_HEIGHT,PAGE_WIDTH = letter
canvas.saveState()
canvas.setPageSize(landscape(letter))
canvas.drawImage(frunt_pag2, 0,0, PAGE_WIDTH,PAGE_HEIGHT )
canvas.setStrokeColorRGB(0,1,1,alpha=0.1)
ficha_no = doc.page-1
#canvas.setStrokeColorRGB(0.7,0.7,0.7)
canvas.setFillColorRGB(0,0,0)
SHOW_GRID = False
if SHOW_GRID:
n = 5
s = 200
canvas.setFillColorRGB(0,0,1)
canvas.setFont('Helvetica',1)
for x in range(s):
for y in range(s):
canvas.rect(x*n,y*n, width=n, height=n, stroke=1)
canvas.drawString(x*n,y*n,"%s,%s" % ((x*n),(y*n)) )
# for i in range(s):
# x= i*n
# y=x
# canvas.drawString(x,0,"%s" % (x)) #horizontal
# canvas.drawString(0,y+1,"%s" % (x)) # vertical
# canvas.drawString(x,600,"%s" % (x)) #horizontal
# canvas.drawString(990,y,"%s" % (x)) # vertical
#
# canvas.setStrokeColorRGB(0,0,1,alpha=0.7)
# canvas.setFont('Helvetica',1)
# for i in range(610):
# #canvas.rect(35,i*2, width=0.5, height=0.5, stroke=1)
# canvas.drawString(35,i,"%s -" % (i,) )
canvas.setFont('Helvetica',7)
LINE_1 = 508
#fecha_elaboracion = doc.fecha_elaboracion
#if not fecha_elaboracion:
# fecha_elaboracion = datetime.today()
canvas.drawCentredString(137,LINE_1,str(fecha_elaboracion.year))
canvas.drawCentredString(162,LINE_1,str(fecha_elaboracion.month))
canvas.drawCentredString(180,LINE_1,str(fecha_elaboracion.day))
canvas.drawCentredString(290,LINE_1,"VALLE DEL CAUCA")
canvas.drawCentredString(740,LINE_1,"Ficha No. %s" % (int(ficha_no)+int(no_ficha_inicial)-1))
canvas.setFont('Helvetica',5)
canvas.drawString(75,115, "Elaboro: %s" % elaboro)
canvas.drawString(215,115, "Reviso: %s" % reviso)
canvas.restoreState()
开发者ID:luissalamanca22,项目名称:dubs_django,代码行数:60,代码来源:test.py
示例4: draw_debug_outline
def draw_debug_outline(self, config ):
"""draw an outline around the box"""
canvas = self.canvas
# don't muck up the external state
canvas.saveState()
# discreet - but visible
canvas.setStrokeColorRGB( 0.9, 0.7, 0.7 )
canvas.setFillColorRGB( 0.6, 0.6, 0.6 )
canvas.setFont( 'Helvetica', 8 )
# draw a box to show the extent
canvas.rect(
config['x'], config['y'], config['w'], config['h'],
stroke=1, fill=0,
)
# put in some debug info
canvas.drawRightString(
config['x'] + config['w'],
config['y'] + 4,
', '.join(config['content'])
)
# restore state
canvas.restoreState()
开发者ID:mysociety,项目名称:ukonlinetutordb,代码行数:27,代码来源:certificate_pdf.py
示例5: draw_angle_lines
def draw_angle_lines(canvas, angles, distance, pagesize, grey):
"Draws oblique lines to help with pen positioning and serifs"
angles = (float(x.strip()) for x in angles.split(","))
if grey:
canvas.setStrokeColorRGB(0.7, 0.7, 0.7)
for i in angles:
draw_lines_for_angle(canvas, i, distance, pagesize)
开发者ID:nibrahim,项目名称:Calligraphic-Rulings,代码行数:7,代码来源:ruling.py
示例6: drawCrossHairs
def drawCrossHairs(canvas, x, y):
"""just a marker for checking text metrics - blue for fun"""
canvas.saveState()
canvas.setStrokeColorRGB(0, 1, 0)
canvas.line(x - 6, y, x + 6, y)
canvas.line(x, y - 6, x, y + 6)
canvas.restoreState()
开发者ID:jameshickey,项目名称:ReportLab,代码行数:8,代码来源:test_pdfgen_general.py
示例7: framePage
def framePage(canvas, title, pos):
canvas.setFont('Times-Roman', 15)
canvas.drawString(inch, pos * inch, title)
canvas.setFont('Times-Roman', 10)
canvas.drawCentredString(4.135 * inch, 0.75 * inch,
'Página %d' % canvas.getPageNumber())
#reset carefully afterwards
canvas.setLineWidth(1)
canvas.setStrokeColorRGB(0, 0, 0)
开发者ID:alemcito,项目名称:malteria-backus,代码行数:9,代码来源:reportar.py
示例8: draw_header
def draw_header(canvas):
""" Draws the invoice header """
canvas.setStrokeColorRGB(176/255., 196/255., 222/255.)
# canvas.setStrokeColorRGB(0.9, 0.5, 0.2)
canvas.setFillColorRGB(0.2, 0.2, 0.2)
canvas.setFont('Helvetica', 16)
canvas.drawString(18 * cm, -1 * cm, 'Invoice')
if consultant_logo_filename:
canvas.drawInlineImage(consultant_logo_filename, 1 * cm, -1 * cm, 250, 16)
canvas.setLineWidth(4)
canvas.line(0, -1.25 * cm, 21.7 * cm, -1.25 * cm)
开发者ID:ses4j,项目名称:ts,代码行数:11,代码来源:invoice.py
示例9: drawlines
def drawlines(canvas):
canvas.setStrokeColorRGB(0.2,0.5,0.3)
canvas.line(0,0,70,70)
textobject = canvas.beginText()
textobject.setTextOrigin(51.2,749)
textobject.textLines('''
LEFT
FIELD
LABS
''')
canvas.drawText(textobject)
开发者ID:codedcolors,项目名称:lflpdf,代码行数:11,代码来源:maketimeline.py
示例10: myFirstPage
def myFirstPage(canvas, doc):
PAGE_HEIGHT,PAGE_WIDTH = letter
canvas.saveState()
canvas.drawImage(fondo, 0,0, PAGE_HEIGHT, PAGE_WIDTH )
canvas.setStrokeColorRGB(1,0,1,alpha=0.1)
#canvas.setPageSize(landscape(letter))
canvas.setFont('Arial', 10)
canvas.drawString(150, 579, cuenta_cobro.nombre_dependencia)
canvas.drawString(215, 558, cuenta_cobro.fecha_transaccion)
canvas.drawString(284, 538, cuenta_cobro.nombre_adquiriente)
canvas.drawString(90, 513, cuenta_cobro.nit_adquiriente)
canvas.drawString(230, 513, cuenta_cobro.direccion_adquiriente)
canvas.drawString(492, 513, cuenta_cobro.telefono_adquiriente)
canvas.drawString(120, 488, cuenta_cobro.ciudad_adquiriente)
#
canvas.drawString(285, 474, cuenta_cobro.nombre_beneficiario)
canvas.drawString(140, 448, cuenta_cobro.documento_beneficiario)
canvas.drawString(365, 448, cuenta_cobro.direccion_beneficiario)
canvas.drawString(120, 425, cuenta_cobro.telefono_beneficiario)
canvas.drawString(360, 425, cuenta_cobro.email_beneficiario)
canvas.drawString(115, 410, cuenta_cobro.ciudad_beneficiario)
cuenta_cobro.objeto_contrato = textwrap.fill(cuenta_cobro.objeto_contrato, 80)
textobject = canvas.beginText()
textobject.setTextOrigin(63, 365)
textobject.textLines(cuenta_cobro.objeto_contrato)
canvas.drawText(textobject)
canvas.drawString(117, 297, cuenta_cobro.no_rpc)
canvas.drawString(242, 297, cuenta_cobro.no_cdp)
canvas.drawString(392, 297, cuenta_cobro.valor_contrato)
canvas.drawString(127, 282, cuenta_cobro.concepto)
canvas.drawString(127, 268, cuenta_cobro.valor_concepto)
canvas.drawString(95, 255, cuenta_cobro.valor_concepto_letras)
SHOW_GRID = False
if SHOW_GRID:
n = 5
s = 200
#canvas.setStrokeGray(0.90)
#canvas.setFillGray(0.90)
canvas.setStrokeColorRGB(0,1,1,alpha=0.1)
canvas.setFillColorRGB(1,0,1)
canvas.setFont('Arial',1)
for x in range(s):
for y in range(s):
canvas.rect(x*n,y*n, width=n, height=n, stroke=1)
canvas.drawString(x*n,y*n,"%s,%s" % ((x*n),(y*n)) )
canvas.restoreState()
开发者ID:luissalamanca22,项目名称:dubs_django,代码行数:52,代码来源:services.py
示例11: framePage
def framePage(canvas, doc):
# canvas.drawImage("snkanim.gif", 36, 36)
canvas.saveState()
canvas.setStrokeColorRGB(1, 0, 0)
canvas.setLineWidth(5)
canvas.line(66, 72, 66, PAGE_HEIGHT - 72)
canvas.setFont("Times-Italic", 12)
canvas.drawRightString(523, PAGE_HEIGHT - 56, "Platypus User Guide and Test Script")
canvas.setFont("Times-Roman", 12)
canvas.drawString(4 * inch, 0.75 * inch, "Page %d" % canvas.getPageNumber())
canvas.restoreState()
开发者ID:jameshickey,项目名称:ReportLab,代码行数:13,代码来源:test_platypus_general.py
示例12: printBandOutline
def printBandOutline(self, canvas, text):
""" Draw a dotted rectangle around the entire band, and type a small faded
caption at the origin of the band.
"""
canvas.saveState()
canvas.setLineWidth(0.1)
canvas.setStrokeColorRGB(0.8, 0.5, 0.7)
canvas.setDash(1, 2)
canvas.rect(self.x, self.y, self.width, self.height)
canvas.setFont("Helvetica", 8)
canvas.setFillColor((0.6, 0.8, 0.7))
canvas.drawString(self.x, self.y, text)
canvas.restoreState()
开发者ID:biobot500,项目名称:addabaji-ci,代码行数:13,代码来源:report.py
示例13: framePage
def framePage(canvas, title):
canvas.setFont("Times-BoldItalic", 20)
canvas.drawString(inch, 10.5 * inch, title)
canvas.setFont("Times-Roman", 10)
canvas.drawCentredString(4.135 * inch, 0.75 * inch, "Page %d" % canvas.getPageNumber())
# draw a border
canvas.setStrokeColorRGB(1, 0, 0)
canvas.setLineWidth(5)
canvas.line(0.8 * inch, inch, 0.8 * inch, 10.75 * inch)
# reset carefully afterwards
canvas.setLineWidth(1)
canvas.setStrokeColorRGB(0, 0, 0)
开发者ID:radical-software,项目名称:radicalspam,代码行数:14,代码来源:test_lib_colors.py
示例14: gentestlabels
def gentestlabels():
# ascertain edges
global gl_printer
(xwidth, yheight) = letter
margin = .3*inch
xwidth -= margin*2
yheight -= margin*2
xorg = yorg = margin
canvas = canvas_init('tmp/kitlabels.pdf',pagesize=letter,bottomup=1,verbosity=1)
canvas.setStrokeColorRGB(.33,.33,.33)
canvas.setFont('Helvetica',10)
yrows = 3
xcols = 2
ystep = yheight/yrows
xstep = xwidth/xcols
v('xystep: %f %f' % (xstep,ystep) )
x = xorg
i = 0
pages = 2
for page in range(pages):
if (page != 0):
canvas.showPage()
y = yheight-ystep+margin
for yrowcount in reversed(range(yrows)):
for xcolcount in reversed(range(xcols)):
genkitlabel(canvas, x,y,xstep,ystep,'',test=1)
i += 1
x += xstep
x = xorg
y -= ystep
finish_up(canvas)
exit()
开发者ID:adioslabs,项目名称:barcodatron,代码行数:45,代码来源:kitlabels.py
示例15: prepare_first_page
def prepare_first_page(canvas, document):
p1 = Paragraph(presentation.title, styles['Heading'])
p2 = Paragraph(presentation.owner.get_full_name(), styles['SubHeading'])
avail_width = width - inch
# TODO: determine if the complaint about height being undeclared is just pycharm or if its a problem
# if it is possibly a problem "it's better to be explicit" so refactor
avail_height = height - inch
w1, h1 = p1.wrap(avail_width, avail_height)
w2, h2 = p2.wrap(avail_width, avail_height)
f = Frame(inch / 2, inch / 2, width - inch, height - inch,
leftPadding=0, bottomPadding=0, rightPadding=0, topPadding=0)
f.addFromList([p1, p2], canvas)
document.pageTemplate.frames[0].height -= h1 + h2 + inch / 2
document.pageTemplate.frames[1].height -= h1 + h2 + inch / 2
canvas.saveState()
canvas.setStrokeColorRGB(0, 0, 0)
canvas.line(width / 2, inch / 2, width / 2, height - inch - h1 - h2)
canvas.restoreState()
开发者ID:eResearchSandpit,项目名称:rooibos,代码行数:20,代码来源:viewers.py
示例16: draw_page
def draw_page(page, uid, survey_name, canvas : reportlab.pdfgen.canvas.Canvas):
draw_qr_data(canvas, 'survey:'+survey_name+':'+page.name+':'+uid, 64, (48, height-64-48))
canvas.setFillColorRGB(0.2, 0.2, 0.2)
canvas.setStrokeColorRGB(0.2, 0.2, 0.2)
canvas.circle(32, 32, 4, stroke=1, fill=1)
canvas.circle(32+12, 32, 4, stroke=1, fill=1)
canvas.circle(32, 32+12, 4, stroke=1, fill=1)
canvas.circle(width - 32, height - 32, 4, stroke=1, fill=1)
canvas.circle(width - 32-12, height - 32, 4, stroke=1, fill=1)
canvas.circle(width - 32, height - 32-12, 4, stroke=1, fill=1)
canvas.circle(width - 32, 32, 4, stroke=1, fill=1)
canvas.circle(width - 32-12, 32, 4, stroke=1, fill=1)
canvas.circle(width - 32, 32+12, 4, stroke=1, fill=1)
canvas.circle(32, height - 32, 4, stroke=1, fill=1)
canvas.circle(32+12, height - 32, 4, stroke=1, fill=1)
canvas.circle(32, height - 32-12, 4, stroke=1, fill=1)
canvas.setFillColorRGB(0.3, 0.3, 0.3)
canvas.drawString(128, height - 67, survey_name+':'+page.name+':'+uid)
canvas.setFillColorRGB(0.4, 0.4, 0.4)
canvas.setStrokeColorRGB(0.2, 0.2, 0.2)
canvas.setFont('Courier', 8)
for field in page.get_binary_fields():
canvas.circle(field.position[0], height - field.position[1], 5, stroke=1, fill=0)
canvas.drawCentredString(field.position[0], height - field.position[1]-2, field.hint)
canvas.setFillColorRGB(0.1, 0.1, 0.1)
for text in page.get_text_areas():
if text.rotation != 0:
canvas.saveState()
canvas.rotate(text.rotation)
tobj = canvas.beginText(text.position[0], height - text.position[1])
tobj.setFont(text.fontname, text.fontsize)
for line in text.text.split():
tobj.textLine(line)
canvas.drawText(tobj)
if text.rotation != 0:
canvas.restoreState()
canvas.showPage()
开发者ID:wojtex,项目名称:opensurvey,代码行数:41,代码来源:generator.py
示例17: drawGuides
def drawGuides(self):
canvas = self.canvas
left = self.offsetx
right = left + self.cardw*self.columns
top = self.offsety + self.cardh
bottom = top - self.cardh*self.rows
canvas.setLineWidth(self.sepwidth)
for ix in range(0, self.columns+1):
x = self.offsetx + self.cardw*ix
canvas.setStrokeColorRGB(*self.guides)
canvas.line(x, self.pagesize[1], x, top)
canvas.line(x, bottom, x, 0)
canvas.setStrokeColorRGB(*self.separators)
canvas.line(x, top, x, bottom)
for iy in range(-1, self.rows):
y = self.offsety - self.cardh*iy
canvas.setStrokeColorRGB(*self.guides)
canvas.line(0, y, left, y)
canvas.line(right, y, self.pagesize[0], y)
canvas.setStrokeColorRGB(*self.separators)
canvas.line(left, y, right, y)
开发者ID:mcccclean,项目名称:card-renderer,代码行数:21,代码来源:pdfcanvas.py
示例18: drawGuides
def drawGuides(self):
GUIDECOLOR = (0.5, 0.5, 0.5)
canvas = self.canvas
left = self.offsetx
right = left + self.cardw*self.columns
top = self.offsety + self.cardh
bottom = top - self.cardh*self.rows
for ix in range(0, self.columns+1):
x = self.offsetx + self.cardw*ix
canvas.setStrokeColorRGB(*GUIDECOLOR)
canvas.line(x, self.pagesize[1], x, top)
canvas.line(x, bottom, x, 0)
canvas.setStrokeColorRGB(1, 1, 1)
canvas.line(x, top, x, bottom)
for iy in range(-1, self.rows):
y = self.offsety - self.cardh*iy
canvas.setStrokeColorRGB(*GUIDECOLOR)
canvas.line(0, y, left, y)
canvas.line(right, y, self.pagesize[0], y)
canvas.setStrokeColorRGB(1, 1, 1)
canvas.line(left, y, right, y)
开发者ID:isaacwilliams,项目名称:card-renderer,代码行数:21,代码来源:pdfcanvas.py
示例19: cinza
canvas.circle(300, 500, 80, stroke=0, fill=1) # Sem contorno e com preenchimento
#
# Colorindo elementos
#
# Parâmetros (R, G, B)
canvas.setFillColorRGB(255, 0, 0)
canvas.rect(60, 300, 50, 100, stroke=0, fill=1)
# Somente uma escala para tons de cinza (0 - 1)
canvas.setFillGray(0.9)
canvas.rect(180, 300, 50, 100, stroke=0, fill=1)
# Alterando a cor da borda
canvas.setStrokeColorRGB(0, 0, 255)
canvas.rect(300, 300, 50, 100, stroke=1, fill=1)
#
# Utilizando o HexCode
#
from reportlab.lib.colors import HexColor
canvas.setFillColor(HexColor('#ff8100'))
canvas.rect(420, 300, 50, 100, stroke=1, fill=1)
canvas.save()
开发者ID:flaviomicheletti,项目名称:flask-collection,代码行数:31,代码来源:extra_020.py
示例20: genkitlabel
def genkitlabel(canvas,xa,ya,xw,yh,contentlist,test=0,paper_size_no=0):
"""
"""
v('[------genkitlabel()')
x = xa
y = ya
m = .05*inch
h = yh # calc height
h -= m*2 # height - margin
w = xw # calc width
w -= m*2 # width - margin
v('genkitlabel() ------')
v('genkitlabel() xa,ya,xw,yh: %f %f %f %f' % (xa,ya,xw,yh))
v('genkitlabel() m h w : %f %f %f' % ( m, h, w))
xo = yo = m # origin
canvas.setLineWidth(.01*inch)
canvas.setStrokeColorRGB(.75,.75,.75)
global xwidth
if (not (xwidth/inch <= 3.50)):
cutmark(canvas,x,y,1,1)
cutmark(canvas,x+xw,y+yh,-1,-1)
cutmark(canvas,x,y+yh,1,-1)
cutmark(canvas,x+xw,y,-1,1)
didlogo = False
yloc = y + h
image_size = 1.2*inch
logo_yloc = yloc-image_size+.2*inch
yrel = 0
for line in contentlist:
if (line == '..' or line == '.'):
flip = False
break
v('genkitlabel(): line:%s' %(line))
token = line.split()
if len(token) <= 0:
continue
dowhat = token[0].upper()
#---
global flip
if (dowhat == 'FLIP'):
flip = True
elif (dowhat == 'LOGO'):
v('LOGO')
if (len(token) == 1):
# no arg print logo
if (paper_size_no == 3):
image_size = 1*inch
canvas.drawImage('logo512x512.png', x+m-.75*inch,logo_yloc, image_size, image_size, preserveAspectRatio=True)
else:
canvas.drawImage('logo512x512.png', x+m+.1*inch+2.4*inch,logo_yloc, image_size, image_size, preserveAspectRatio=True)
else:
# print arg
arg = token[1]
if (len(arg) == 1):
# character. make it big
if flip:
# They said 'LOGO X', so we draw big fat X where the logo should be
canvas.saveState()
canvas.translate(x+m+.3*inch,logo_yloc+1*inch)
canvas.scale(-1,-1)
canvas.setFont('Helvetica-Bold',70)
canvas.drawString(0,0,token[1])
canvas.restoreState()
else:
# They said 'LOGO X', so we draw big fat X where the logo should be
canvas.setFont('Helvetica-Bold',70)
canvas.drawString(x+m-.45*inch,logo_yloc+.2*inch,token[1])
else:
# Multiple characters
if flip:
# They said 'LOGO X', so we draw big fat X where the logo should be
canvas.saveState()
canvas.translate(x+m+.3*inch,logo_yloc+1*inch)
canvas.scale(-1,-1)
canvas.setFont('Helvetica-Bold',20)
canvas.drawString(.5*inch,.55*inch,arg[0])
canvas.drawString(.5*inch,.30*inch,arg[1])
canvas.drawString(.5*inch,.05*inch,arg[2])
canvas.restoreState()
else:
# They said 'LOGO X', so we draw big fat X where the logo should be
canvas.setFont('Helvetica-Bold',20)
#.........这里部分代码省略.........
开发者ID:adioslabs,项目名称:barcodatron,代码行数:101,代码来源:kitlabels.py
注:本文中的reportlab.pdfgen.canvas.setStrokeColorRGB函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论