def generate_qr(request, route_id):
    if not request.user.is_authenticated:
        return render(request, "not_registered.html")
        
    route = Route.objects.get(uuid=route_id)
    # Get routes
    checkpoints = Checkpoint.objects.filter(route=route_id).order_by('name')

    # Get teams
    teams = Team.objects.filter(route=route_id).all()

    # Create the HttpResponse object with the appropriate PDF headers.
    response = HttpResponse(content_type='application/pdf')
    response['Content-Disposition'] = f'attachment; filename="{route.name}.pdf"'

    p = canvas.Canvas(response)

    for checkpoint in checkpoints:
        qrw = QrCodeWidget(f"https://piraat-hike-tracker.herokuapp.com/checkpoint/{checkpoint.uuid}") 
        b = qrw.getBounds()
        qrw.barHeight = 20*cm
        qrw.barWidth = 20*cm

        d = Drawing(20*cm, 20*cm) 
        d.add(qrw)
        p.setFont('Helvetica',20)
        p.drawCentredString(21*cm/2, 24*cm, "CHECKPOINT")
        p.setFont('Helvetica',30)
        p.drawCentredString(21*cm/2, 22*cm, checkpoint.name)
        p.setFont('Helvetica',15)
        p.drawCentredString(21*cm/2, 20*cm, f"QR code voor {route.name}. S.v.p. laten hangen.")

        renderPDF.draw(d, p, 0, 0)
        
        p.showPage()
    
    for team in teams:
        qrw = QrCodeWidget(f"https://piraat-hike-tracker.herokuapp.com/register/{team.uuid}") 
        b = qrw.getBounds()

        qrw.barHeight = 10*cm
        qrw.barWidth = 10*cm

        d = Drawing(10*cm, 10*cm) 
        d.add(qrw)
        p.setFont('Helvetica',20)
        p.drawCentredString(21*cm/2, 24*cm, "TEAM")
        p.setFont('Helvetica',30)
        p.drawCentredString(21*cm/2, 22*cm, team.name)
        p.setFont('Helvetica',15)
        p.drawCentredString(21*cm/2, 20*cm, f"Scan mij om je telefoon te registreren!")

        renderPDF.draw(d, p, 5*cm, 0)
        
        p.showPage()
    
    p.save()
    return response
Beispiel #2
0
def print_poster_A4(request, qr_id):
    qrcode = QRcode.objects.get(pk=int(qr_id))
    response = HttpResponse(mimetype='application/pdf')
    response['Content-Disposition'] = 'attachment; filename="posterA4-%s.pdf"; size=A4' % (str(qrcode.room.room_number))

    p = canvas.Canvas(response)
    p.drawImage('/home/cgaspoz/Dev/voices/static/templates/talk_to_us_A4.jpg', 0, 0, width=210*mm, height=297*mm)

    qr_size = 90.5*mm
    qr_x = 60*mm
    qr_y = 63*mm

    qrw = QrCodeWidget(settings.HTTP_URL + "qr/" + str(qrcode.qr) + "/")
    qrw.barHeight = qr_size
    qrw.barWidth = qr_size
    qrw.barLevel = 'Q'  # M, L, H, Q
    qrw.barBorder = 0

    d = Drawing(qr_size, qr_size)
    d.add(qrw)
    d.add(Rect(5.6*mm, 5.6*mm, 8*mm, 8*mm, strokeColor=colors.CMYKColor(1, 0, 0, 0), fillColor=colors.CMYKColor(1, 0, 0, 0)))
    d.add(Rect(76.9*mm, 76.9*mm, 8*mm, 8*mm, strokeColor=colors.CMYKColor(1, 0, 0, 0), fillColor=colors.CMYKColor(1, 0, 0, 0)))
    d.add(Rect(5.6*mm, 76.9*mm, 8*mm, 8*mm, strokeColor=colors.CMYKColor(1, 0, 0, 0), fillColor=colors.CMYKColor(1, 0, 0, 0)))

    renderPDF.draw(d, p, qr_x, qr_y)

    p.showPage()

    text = p.beginText()
    text.setTextOrigin(12*mm,277*mm)
    text.setFillGray(0.5)
    text.setFont("Helvetica", 10)
    text.textLines('''
        Talk to us! @ HE-Arc
        Campus: %s
        Building: %s
        Floor: %s
        Room: %s-%s
        QR-Code: %s''' % (qrcode.room.floor.building.campus.name, qrcode.room.floor.building.name,
                          qrcode.room.floor.floor_display, qrcode.room.room_number, qrcode.room.room_name, qrcode.qr))
    p.drawText(text)

    p.showPage()

    p.save()

    return response
Beispiel #3
0
def users_passwords_to_pdf(pdf):
    """
    Create access data sheets for all users as PDF
    """
    users_pdf_wlan_ssid = config["users_pdf_wlan_ssid"] or "-"
    users_pdf_wlan_password = config["users_pdf_wlan_password"] or "-"
    users_pdf_wlan_encryption = config["users_pdf_wlan_encryption"] or "-"
    users_pdf_url = config["users_pdf_url"] or "-"
    users_pdf_welcometitle = config["users_pdf_welcometitle"]
    users_pdf_welcometext = config["users_pdf_welcometext"]
    if config['users_sort_users_by_first_name']:
        sort = 'first_name'
    else:
        sort = 'last_name'
    qrcode_size = 2 * cm
    # qrcode for system url
    qrcode_url = QrCodeWidget(users_pdf_url)
    qrcode_url.barHeight = qrcode_size
    qrcode_url.barWidth = qrcode_size
    qrcode_url.barBorder = 0
    qrcode_url_draw = Drawing(45, 45)
    qrcode_url_draw.add(qrcode_url)
    # qrcode for wlan
    text = "WIFI:S:%s;T:%s;P:%s;;" % (users_pdf_wlan_ssid,
                                      users_pdf_wlan_encryption,
                                      users_pdf_wlan_password)
    qrcode_wlan = QrCodeWidget(text)
    qrcode_wlan.barHeight = qrcode_size
    qrcode_wlan.barWidth = qrcode_size
    qrcode_wlan.barBorder = 0
    qrcode_wlan_draw = Drawing(45, 45)
    qrcode_wlan_draw.add(qrcode_wlan)

    for user in User.objects.all().order_by(sort):
        pdf.append(Paragraph(escape(user), stylesheet['h1']))
        pdf.append(Spacer(0, 1 * cm))
        data = []
        # WLAN access data
        cell = []
        cell.append(Paragraph(_("WLAN access data"), stylesheet['h2']))
        cell.append(
            Paragraph("%s:" % _("WLAN name (SSID)"), stylesheet['formfield']))
        cell.append(
            Paragraph(escape(users_pdf_wlan_ssid),
                      stylesheet['formfield_value']))
        cell.append(
            Paragraph("%s:" % _("WLAN password"), stylesheet['formfield']))
        cell.append(
            Paragraph(escape(users_pdf_wlan_password),
                      stylesheet['formfield_value']))
        cell.append(
            Paragraph("%s:" % _("WLAN encryption"), stylesheet['formfield']))
        cell.append(
            Paragraph(escape(users_pdf_wlan_encryption),
                      stylesheet['formfield_value']))
        cell.append(Spacer(0, 0.5 * cm))
        # OpenSlides access data
        cell2 = []
        cell2.append(Paragraph(_("OpenSlides access data"), stylesheet['h2']))
        cell2.append(Paragraph("%s:" % _("Username"), stylesheet['formfield']))
        cell2.append(
            Paragraph(escape(user.username), stylesheet['formfield_value']))
        cell2.append(Paragraph("%s:" % _("Password"), stylesheet['formfield']))
        cell2.append(
            Paragraph(escape(user.default_password),
                      stylesheet['formfield_value']))
        cell2.append(Paragraph("URL:", stylesheet['formfield']))
        cell2.append(
            Paragraph(escape(users_pdf_url), stylesheet['formfield_value']))
        data.append([cell, cell2])
        # QRCodes
        cell = []
        if users_pdf_wlan_ssid != "-" and users_pdf_wlan_encryption != "-":
            cell.append(qrcode_wlan_draw)
            cell.append(
                Paragraph(_("Scan this QRCode to connect WLAN."),
                          stylesheet['qrcode_comment']))
        cell2 = []
        if users_pdf_url != "-":
            cell2.append(qrcode_url_draw)
            cell2.append(
                Paragraph(_("Scan this QRCode to open URL."),
                          stylesheet['qrcode_comment']))
        data.append([cell, cell2])
        # build table
        table = Table(data)
        table._argW[0] = 8 * cm
        table._argW[1] = 8 * cm
        table.setStyle(TableStyle([('VALIGN', (0, 0), (-1, -1), 'TOP')]))
        pdf.append(table)
        pdf.append(Spacer(0, 2 * cm))

        # welcome title and text
        pdf.append(Paragraph(escape(users_pdf_welcometitle), stylesheet['h2']))
        pdf.append(
            Paragraph(
                escape(users_pdf_welcometext).replace('\r\n', '<br/>'),
                stylesheet['Paragraph12']))
        pdf.append(PageBreak())
    return pdf
Beispiel #4
0
    def __init__(self, width=1000, height=400, *args, **kwargs):
        Drawing.__init__(self, width, height, *args, **kwargs)
        # background color
        self.background = Rect(0,
                               0,
                               self.width,
                               self.height,
                               strokeWidth=0,
                               fillColor=colors.lightgrey)
        # end here
        self.add(Circle(500, 200, 180), name='circle_perfect')
        self.add(Circle(500, 200, 145), name='circle_good')
        self.add(Circle(500, 200, 115), name='circle_medium')
        self.add(Circle(500, 200, 85), name='circle_bad')
        self.add(Circle(500, 200, 50), name='circle_awful')
        self.add(Circle(500, 200, 20), name='circle_center')
        self.add(SpiderChart(), name='background_chart')
        self.add(SpiderChart(), name='chart')

        # QR code
        qrw = QrCodeWidget('Well met')

        # QR size
        qrw.barHeight = 150
        qrw.barWidth = 150

        # QR position
        qrw.y = 100
        qrw.x = 10

        self.add(qrw)
        # end here

        # barcode
        barcode_group = Group()
        barcode = createBarcodeDrawing('EAN13',
                                       value='1234567890',
                                       width=200,
                                       height=100)

        barcode_group.add(barcode)
        barcode_group.shift(10, 10)  # barcode position
        self.add(barcode_group)
        # end here

        self.add(String(470, 386, 'Аналіз крові'), name='text0')
        self.add(String(605, 352, 'Антропометрія'), name='text1')
        self.add(String(670, 275, 'Постава'), name='text2')
        self.add(String(685, 170, 'Композиція тіла'), name='text3')
        self.add(String(645, 75, 'Електрокардіограмма'), name='text4')
        self.add(String(550, 10, 'Варіаційна пульсометрія'), name='text5')
        self.add(String(350, 10, 'Система дихання'), name='text6')
        self.add(String(220, 75, 'Кистьова динамометрія'), name='text7')
        self.add(String(225, 170, 'Основний обмін'), name='text8')
        self.add(String(160, 275, 'Карідореспіраторний профіль'), name='text9')
        self.add(String(330, 350, 'Психотест'), name='text10')

        # info
        self.add(String(840, 366, 'Чудово'), name='info_perfect')
        self.circle_perfect.fillColor = colors.Color(0, 0, 255, alpha=0.3)
        self.circle_perfect.strokeColor = colors.transparent
        self.info_perfect.fontName = 'HelveticaNeueC'
        self.info_perfect.fontSize = 12
        self.add(Rect(800, 356, 30, 30), name='rect_perfect')
        self.rect_perfect.fillColor = colors.Color(0, 0, 255, alpha=0.3)
        self.rect_perfect.strokeColor = colors.transparent

        self.add(String(840, 326, 'Добре'), name='info_good')
        self.circle_good.fillColor = colors.Color(0, 255, 0, alpha=0.5)
        self.circle_good.strokeColor = colors.transparent
        self.info_good.fontName = 'HelveticaNeueC'
        self.info_good.fontSize = 12
        self.add(Rect(800, 316, 30, 30), name='rect_good')
        self.rect_good.fillColor = colors.Color(0, 255, 0, alpha=0.5)
        self.rect_good.strokeColor = colors.transparent

        self.add(String(840, 286, 'Задовільно'), name='info_medium')
        self.circle_medium.fillColor = colors.yellow
        self.circle_medium.strokeColor = colors.transparent
        self.info_medium.fontName = 'HelveticaNeueC'
        self.info_medium.fontSize = 12
        self.add(Rect(800, 276, 30, 30), name='rect_medium')
        self.rect_medium.fillColor = colors.yellow
        self.rect_medium.strokeColor = colors.transparent

        self.add(String(840, 246, 'Погано'), name='info_bad')
        self.circle_bad.fillColor = colors.orange
        self.circle_bad.strokeColor = colors.transparent
        self.info_bad.fontName = 'HelveticaNeueC'
        self.info_bad.fontSize = 12
        self.add(Rect(800, 236, 30, 30), name='rect_bad')
        self.rect_bad.fillColor = colors.orange
        self.rect_bad.strokeColor = colors.transparent

        self.add(String(840, 206, 'Дуже погано'), name='info_awful')
        self.circle_awful.fillColor = colors.red
        self.circle_awful.strokeColor = colors.transparent
        self.info_awful.fontName = 'HelveticaNeueC'
        self.info_awful.fontSize = 12
        self.add(Rect(800, 196, 30, 30), name='rect_awful')
        self.rect_awful.fillColor = colors.red
        self.rect_awful.strokeColor = colors.transparent

        # end here

        self.chart.x = 20
        self.chart.y = 40
        self.chart.width = self.width - 40
        self.chart.height = self.height - 80

        self.background_chart.x = 10
        self.background_chart.y = 20
        self.background_chart.width = self.width - 20
        self.background_chart.height = self.height - 40

        # ruin has com to my code TODO rework this garbage
        self.text0.fontName = 'HelveticaNeueC'
        self.text0.fontSize = 12
        self.text1.fontName = 'HelveticaNeueC'
        self.text1.fontSize = 12
        self.text2.fontName = 'HelveticaNeueC'
        self.text2.fontSize = 12
        self.text3.fontName = 'HelveticaNeueC'
        self.text3.fontSize = 12
        self.text4.fontName = 'HelveticaNeueC'
        self.text4.fontSize = 12
        self.text5.fontName = 'HelveticaNeueC'
        self.text5.fontSize = 12
        self.text6.fontName = 'HelveticaNeueC'
        self.text6.fontSize = 12
        self.text7.fontName = 'HelveticaNeueC'
        self.text7.fontSize = 12
        self.text8.fontName = 'HelveticaNeueC'
        self.text8.fontSize = 12
        self.text9.fontName = 'HelveticaNeueC'
        self.text9.fontSize = 12
        self.text10.fontName = 'HelveticaNeueC'
        self.text10.fontSize = 12
        # end here aaaaaaaaaaaaaaaaaa

        self.chart.labels = [
            ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '
        ]
        self.background_chart.labels = [
            ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '
        ]

        self.chart.data = [
            [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],  # style
            [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],  # style
            [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],  # style
            [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],  # style
            [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],  # style
            [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],  # values
        ]

        self.background_chart.data = [
            [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],  # style
            [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],  # style
            [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],  # style
            [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],  # style
            [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],  # style
        ]

        # style
        self.chart.strands.strokeColor = colors.transparent
        self.background_chart.strands.strokeColor = colors.transparent
        self.background_chart.spokes.strokeColor = colors.lightgrey
        # self.chart.strands[1].strokeWidth = 15
        # self.chart.strands[1].strokeColor = colors.lightgreen
        # self.chart.strands[2].strokeWidth = 15
        # self.chart.strands[2].strokeColor = colors.yellow
        # self.chart.strands[3].strokeWidth = 15
        # self.chart.strands[3].strokeColor = colors.orange
        # self.chart.strands[4].strokeWidth = 15
        # self.chart.strands[4].strokeColor = colors.red

        # self.background_chart.strands[0].fillColor = colors.Color(0, 0, 255, alpha=0.3)
        # self.background_chart.strands[1].fillColor = colors.Color(0, 255, 0, alpha=0.5)
        # self.background_chart.strands[2].fillColor = colors.yellow
        # self.background_chart.strands[3].fillColor = colors.orange
        # self.background_chart.strands[4].fillColor = colors.red

        # self.chart.strands[0].strokeColor = colors.blue
        # self.chart.strands[0].strokeDashArray = (4, 4)
        # self.chart.strands[0].symbol = makeMarker("Circle")
        # self.chart.strands[0].strokeWidth = 0.5
        # self.chart.strands[0].symbol.fillColor = colors.black

        #end here

        self.chart.strandLabels.format = 'values'

        # main graph style
        self.chart.strands[5].strokeColor = colors.darkblue
        self.chart.spokes.strokeColor = colors.transparent

        self.chart.strands[5].symbol = makeMarker('FilledCircle', size=11)
        # self.chart.strandLabels.dR = -20
        self.chart.strands[5].symbol.fillColor = colors.white
        self.chart.strands[5].strokeWidth = 2
Beispiel #5
0
    def append_to_pdf(self, story):
        system_wlan_ssid = config["system_wlan_ssid"] or "-"
        system_wlan_password = config["system_wlan_password"] or "-"
        system_wlan_encryption = config["system_wlan_encryption"] or "-"
        system_url = config["system_url"] or "-"
        participant_pdf_welcometitle = config["participant_pdf_welcometitle"]
        participant_pdf_welcometext = config["participant_pdf_welcometext"]
        if config['participant_sort_users_by_first_name']:
            sort = 'first_name'
        else:
            sort = 'last_name'
        qrcode_size = 2 * cm
        # qrcode for system url
        qrcode_url = QrCodeWidget(system_url)
        qrcode_url.barHeight = qrcode_size
        qrcode_url.barWidth = qrcode_size
        qrcode_url.barBorder = 0
        qrcode_url_draw = Drawing(45, 45)
        qrcode_url_draw.add(qrcode_url)
        # qrcode for wlan
        text = "WIFI:S:%s;T:%s;P:%s;;" % (system_wlan_ssid, system_wlan_encryption, system_wlan_password)
        qrcode_wlan = QrCodeWidget(text)
        qrcode_wlan.barHeight = qrcode_size
        qrcode_wlan.barWidth = qrcode_size
        qrcode_wlan.barBorder = 0
        qrcode_wlan_draw = Drawing(45, 45)
        qrcode_wlan_draw.add(qrcode_wlan)

        for user in User.objects.all().order_by(sort):
            story.append(Paragraph(unicode(user), stylesheet['h1']))
            story.append(Spacer(0, 1 * cm))
            data = []
            # WLAN access data
            cell = []
            cell.append(Paragraph(_("WLAN access data"),
                        stylesheet['h2']))
            cell.append(Paragraph("%s:" % _("WLAN name (SSID)"),
                        stylesheet['formfield']))
            cell.append(Paragraph(system_wlan_ssid,
                        stylesheet['formfield_value']))
            cell.append(Paragraph("%s:" % _("WLAN password"),
                        stylesheet['formfield']))
            cell.append(Paragraph(system_wlan_password,
                        stylesheet['formfield_value']))
            cell.append(Paragraph("%s:" % _("WLAN encryption"),
                        stylesheet['formfield']))
            cell.append(Paragraph(system_wlan_encryption,
                        stylesheet['formfield_value']))
            cell.append(Spacer(0, 0.5 * cm))
            # OpenSlides access data
            cell2 = []
            cell2.append(Paragraph(_("OpenSlides access data"),
                         stylesheet['h2']))
            cell2.append(Paragraph("%s:" % _("Username"),
                         stylesheet['formfield']))
            cell2.append(Paragraph(user.username,
                         stylesheet['formfield_value']))
            cell2.append(Paragraph("%s:" % _("Password"),
                         stylesheet['formfield']))
            cell2.append(Paragraph(user.default_password,
                         stylesheet['formfield_value']))
            cell2.append(Paragraph("URL:",
                         stylesheet['formfield']))
            cell2.append(Paragraph(system_url,
                         stylesheet['formfield_value']))
            data.append([cell, cell2])
            # QRCodes
            cell = []
            if system_wlan_ssid != "-" and system_wlan_encryption != "-":
                cell.append(qrcode_wlan_draw)
                cell.append(Paragraph(_("Scan this QRCode to connect WLAN."),
                            stylesheet['qrcode_comment']))
            cell2 = []
            if system_url != "-":
                cell2.append(qrcode_url_draw)
                cell2.append(Paragraph(_("Scan this QRCode to open URL."),
                             stylesheet['qrcode_comment']))
            data.append([cell, cell2])
            # build table
            table = Table(data)
            table._argW[0] = 8 * cm
            table._argW[1] = 8 * cm
            table.setStyle(TableStyle([('VALIGN', (0, 0), (-1, -1), 'TOP')]))
            story.append(table)
            story.append(Spacer(0, 2 * cm))

            # welcome title and text
            story.append(Paragraph(participant_pdf_welcometitle,
                         stylesheet['h2']))
            story.append(Paragraph(participant_pdf_welcometext.replace('\r\n', '<br/>'),
                         stylesheet['Paragraph12']))
            story.append(PageBreak())
Beispiel #6
0
def users_passwords_to_pdf(pdf):
    """
    Create access data sheets for all users as PDF.
    """
    users_pdf_wlan_ssid = config["users_pdf_wlan_ssid"] or "-"
    users_pdf_wlan_password = config["users_pdf_wlan_password"] or "-"
    users_pdf_wlan_encryption = config["users_pdf_wlan_encryption"] or "-"
    users_pdf_url = config["users_pdf_url"] or "-"
    users_pdf_welcometitle = config["users_pdf_welcometitle"]
    users_pdf_welcometext = config["users_pdf_welcometext"]
    if config['users_sort_users_by_first_name']:
        sort = 'first_name'
    else:
        sort = 'last_name'
    qrcode_size = 2 * cm
    # qrcode for system url
    qrcode_url = QrCodeWidget(users_pdf_url)
    qrcode_url.barHeight = qrcode_size
    qrcode_url.barWidth = qrcode_size
    qrcode_url.barBorder = 0
    qrcode_url_draw = Drawing(45, 45)
    qrcode_url_draw.add(qrcode_url)
    # qrcode for wlan
    text = "WIFI:S:%s;T:%s;P:%s;;" % (users_pdf_wlan_ssid, users_pdf_wlan_encryption, users_pdf_wlan_password)
    qrcode_wlan = QrCodeWidget(text)
    qrcode_wlan.barHeight = qrcode_size
    qrcode_wlan.barWidth = qrcode_size
    qrcode_wlan.barBorder = 0
    qrcode_wlan_draw = Drawing(45, 45)
    qrcode_wlan_draw.add(qrcode_wlan)

    for user in User.objects.all().order_by(sort):
        pdf.append(Paragraph(escape(user.get_full_name()), stylesheet['h1']))
        pdf.append(Spacer(0, 1 * cm))
        data = []
        # WLAN access data
        cell = []
        cell.append(Paragraph(_("WLAN access data"),
                    stylesheet['h2']))
        cell.append(Paragraph("%s:" % _("WLAN name (SSID)"),
                    stylesheet['formfield']))
        cell.append(Paragraph(escape(users_pdf_wlan_ssid),
                    stylesheet['formfield_value']))
        cell.append(Paragraph("%s:" % _("WLAN password"),
                    stylesheet['formfield']))
        cell.append(Paragraph(escape(users_pdf_wlan_password),
                    stylesheet['formfield_value']))
        cell.append(Paragraph("%s:" % _("WLAN encryption"),
                    stylesheet['formfield']))
        cell.append(Paragraph(escape(users_pdf_wlan_encryption),
                    stylesheet['formfield_value']))
        cell.append(Spacer(0, 0.5 * cm))
        # OpenSlides access data
        cell2 = []
        cell2.append(Paragraph(_("OpenSlides access data"),
                     stylesheet['h2']))
        cell2.append(Paragraph("%s:" % _("Username"),
                     stylesheet['formfield']))
        cell2.append(Paragraph(escape(user.username),
                     stylesheet['formfield_value']))
        cell2.append(Paragraph("%s:" % _("Password"),
                     stylesheet['formfield']))
        cell2.append(Paragraph(escape(user.default_password),
                     stylesheet['formfield_value']))
        cell2.append(Paragraph("URL:",
                     stylesheet['formfield']))
        cell2.append(Paragraph(escape(users_pdf_url),
                     stylesheet['formfield_value']))
        data.append([cell, cell2])
        # QRCodes
        cell = []
        if users_pdf_wlan_ssid != "-" and users_pdf_wlan_encryption != "-":
            cell.append(qrcode_wlan_draw)
            cell.append(Paragraph(_("Scan this QRCode to connect WLAN."),
                        stylesheet['qrcode_comment']))
        cell2 = []
        if users_pdf_url != "-":
            cell2.append(qrcode_url_draw)
            cell2.append(Paragraph(_("Scan this QRCode to open URL."),
                         stylesheet['qrcode_comment']))
        data.append([cell, cell2])
        # build table
        table = Table(data)
        table._argW[0] = 8 * cm
        table._argW[1] = 8 * cm
        table.setStyle(TableStyle([('VALIGN', (0, 0), (-1, -1), 'TOP')]))
        pdf.append(table)
        pdf.append(Spacer(0, 2 * cm))

        # welcome title and text
        pdf.append(Paragraph(escape(users_pdf_welcometitle), stylesheet['h2']))
        pdf.append(Paragraph(escape(users_pdf_welcometext).replace('\r\n', '<br/>'),
                   stylesheet['Paragraph12']))
        pdf.append(PageBreak())
    return pdf