Пример #1
0
    def number_pdf(self, participant_id):
        raise NotImplementedError
        participant = Participant.objects.get(id=participant_id)
        styles = getSampleStyleSheet()
        output = StringIO.StringIO()

        doc = SimpleDocTemplate(output, pagesize=A4, showBoundary=0)
        elements = []

        if self.competition.logo:
            elements.append(get_image(self.competition.logo.path, width=10*cm))
        elements.append(Paragraph(u"Apsveicam ar sekmīgu reģistrēšanos 24.Latvijas riteņbraucēju Vienības braucienam, kas notiks šo svētdien, 7.septembrī Siguldā!", styles['h3']))

        data = [['Vārds, uzvārds:', participant.full_name],
                ['Dzimšanas gads:', participant.birthday.year],
                ['Distance:', participant.distance], ]
        if participant.primary_number:
            data.append(['Starta numurs', participant.primary_number.number])

        table_style = base_table_style[:]
        table_style.append(['FONTSIZE', (0, 0), (-1, -1), 16])
        table_style.append(['BOTTOMPADDING', (0, 0), (-1, -1), 10])

        elements.append(Spacer(10, 10))
        elements.append(Table(data, style=table_style, hAlign='LEFT'))
        elements.append(Spacer(10, 10))
        elements.append(Paragraph(u"Šo vēstuli lūdzam saglabāt, izprintēt un uzrādīt saņemot starta numuru.", styles['h3']))
        elements.append(Paragraph(u"Starta numurus iespējams saņemt 5. un 6.septembrī pie u/v Elkor Plaza (Brīvības gatve 201, Rīga) laikā no 10:00 līdz 20:00 vai arī 7.septembrī Siguldā, reģistrācijas teltī no 09:00.", styles['h3']))

        elements.append(Paragraph(u"Lūdzam paņemt no reģistrācijas darbiniekiem instrukciju par pareizu numura piestiprināšanu.", styles['h3']))
        elements.append(Paragraph(u"Papildus informāciju meklējiet www.velo.lv", styles['h3']))

        elements.append(Paragraph(u"Vēlreiz apsveicam ar reģistrēšanos Vienības braucienam un novēlam veiksmīgu startu!", styles['h3']))

        elements.append(Paragraph(u"Sajūti kopīgo spēku!", styles['title']))

        elements.append(Paragraph(u"Sacensību organizatori", styles['h3']))

        elements.append(Paragraph(u"Jautājumi?", styles['h2']))
        elements.append(Paragraph(u"Neskaidrību gadījumā sazinieties ar mums: [email protected]", styles['h3']))

        doc.build(elements)
        return output
Пример #2
0
    def number_pdf(self, participant_id):
        participant = Participant.objects.get(id=participant_id)
        styles = getSampleStyleSheet()
        output = StringIO.StringIO()

        doc = SimpleDocTemplate(output, pagesize=A4, showBoundary=0)
        elements = []
        elements.append(get_image(self.competition.logo.path, width=10*cm))
        elements.append(Paragraph(u"Apsveicam ar sekmīgu reģistrēšanos Elkor Rīgas Velomaratonam 2015, kas notiks šo svētdien, 31.maijā 11.novembra Krastmalā!", styles['h3']))

        data = [['Vārds, uzvārds:', participant.full_name],
                ['Dzimšanas gads:', participant.birthday.year],
                ['Distance:', participant.distance], ]
        if participant.primary_number:
            data.append(['Starta numurs', participant.primary_number.number])

        table_style = base_table_style[:]
        table_style.append(['FONTSIZE', (0, 0), (-1, -1), 16])
        table_style.append(['BOTTOMPADDING', (0, 0), (-1, -1), 10])


        elements.append(Table(data, style=table_style, hAlign='LEFT'))

        elements.append(Paragraph(u"Šo vēstuli, lūdzam saglabāt un izprintēt un ņemt līdzi uz Rīgas Velomaratona Expo centru, kas darbosies pie Elkor Plaza Brīvības gatvē 201 29. un 30.maijā no pkst.10:00-21:00.", styles['h3']))
        elements.append(Paragraph(u"Uzrādot šo vēstuli, Jūs varēsiet saņemt aploksni ar savu starta numuru. Lūdzam paņemt no reģistrācijas darbiniekiem instrukciju par pareizu numura piestiprināšanu.", styles['h3']))
        elements.append(Paragraph(u"Papildus informāciju meklējiet www.velo.lv", styles['h3']))
        elements.append(Paragraph(u"Vēlreiz apsveicam ar reģistrēšanos Rīgas Velomaratonam un novēlam veiksmīgu startu!", styles['h3']))

        elements.append(Paragraph(u"Rīga ir mūsu!", styles['title']))

        elements.append(Paragraph(u"Rīgas Velomaratona organizatori", styles['h3']))

        elements.append(Paragraph(u"Jautājumi?", styles['h2']))
        elements.append(Paragraph(u"Neskaidrību gadījumā sazinieties ar mums: [email protected]", styles['h3']))

        doc.build(elements)
        return output
Пример #3
0
from core.models import Competition
from core.pdf import getSampleStyleSheet, ParagraphStyle, PageNumCanvas, base_table_style
from registration.models import Participant
from results.models import Result, SebStandings, TeamResultStandings
from reportlab.lib.pagesizes import A4
from reportlab.platypus import SimpleDocTemplate, Paragraph, Table, Spacer, PageBreak, Image as pdfImage
from reportlab.lib.units import inch, cm
from team.models import MemberApplication
from velo.utils import load_class
from PIL import Image

riga_tz = pytz.timezone("Europe/Riga")

PAGE_HEIGHT = A4[1]
PAGE_WIDTH = A4[0]
styles = getSampleStyleSheet()

group_table_style = base_table_style[:] + [
    ('LINEABOVE', (0, 1), (-1, 1), 0.25, colors.black),
    ('LINEBELOW', (0, 1), (-1, 1), 0.25, colors.black),
    ('SPAN', (0, 0), (3, 0)),
    ('SPAN', (3, 0), (-1, 0)),
    ('ALIGNMENT', (3, 0), (-1, 0), 'RIGHT'),
    ('FONTSIZE', (0, 0), (-1, -1), 8),
]


class PDFReports(object):
    competition = None
    primary_competition = None
    output = None