예제 #1
0
$nb_etiq = 0;
foreach ($members as $member) {
    // Detect page breaks
    if ($nb_etiq % ($preferences->pref_etiq_cols * $preferences->pref_etiq_rows) == 0) {
        $pdf->AddPage();
    }
    // Set font
    $pdf->SetFont(Pdf::FONT, 'B', $preferences->pref_etiq_corps);
    // Compute label position
    $col = $nb_etiq % $preferences->pref_etiq_cols;
    $row = $nb_etiq / $preferences->pref_etiq_cols % $preferences->pref_etiq_rows;
    // Set label origin
    $x = $xorigin + $col * (round($preferences->pref_etiq_hsize) + round($preferences->pref_etiq_hspace));
    $y = $yorigin + $row * (round($preferences->pref_etiq_vsize) + round($preferences->pref_etiq_vspace));
    // Draw a frame around the label
    $pdf->Rect($x, $y, $w, $h);
    // Print full name
    $pdf->SetXY($x, $y);
    $pdf->Cell($w, $line_h, $member->sfullname, 0, 0, 'L', 0);
    // Print first line of address
    $pdf->SetFont(Pdf::FONT, '', $preferences->pref_etiq_corps);
    $pdf->SetXY($x, $y + $line_h);
    //if member address is missing but there is a parent,
    //take the parent address
    $address = $member->address;
    $address_continuation = $member->address_continuation;
    $zip = $member->zipcode;
    $town = $member->town;
    if (empty($address) && $member->hasParent()) {
        $address = $member->parent->address;
        $address_continuation = $member->parent->address_continuation;
예제 #2
0
    $fontsz = 8;
    $pdf->SetFontSize($fontsz);
    while ($pdf->GetStringWidth($nom_adh_ext) > $max_text_size) {
        $fontsz--;
        $pdf->SetFontSize($fontsz);
    }
    $pdf->SetXY($x0 + 27, $pdf->getY() + 4);
    //$pdf->setX($x0 + 27);
    $pdf->writeHTML($nom_adh_ext, true, 0);
    // Email (adapt too)
    $fontsz = 6;
    $pdf->SetFontSize($fontsz);
    while ($pdf->GetStringWidth($email) > $max_text_size) {
        $fontsz--;
        $pdf->SetFontSize($fontsz);
    }
    $pdf->setX($x0 + 27);
    $pdf->writeHTML($email, false, 0);
    // Lower colored strip with long text
    $pdf->SetFillColor($fcol['R'], $fcol['G'], $fcol['B']);
    $pdf->SetTextColor($tcol['R'], $tcol['G'], $tcol['B']);
    $pdf->SetFont(Pdf::FONT, 'B', 6);
    $pdf->SetXY($x0, $y0 + 33);
    $pdf->Cell($w, 7, $preferences->pref_card_strip, 0, 0, 'C', 1);
    // Draw a gray frame around the card
    $pdf->Rect($x0, $y0, $w, $h);
    $nb_card++;
}
// Send PDF code to browser
$session['pdf_error'] = false;
$pdf->Output(_T("Cards") . '.pdf', 'D');