![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 3 Pomógł: 0 Dołączył: 12.12.2011 Ostrzeżenie: (0%) ![]() ![]() |
Witam,
mamy mały problem z tworzeniem się kolejnych stron w PDFie. Ustawiłem " $pdf->SetAutoPageBreak(true,20); ", ale niestety nie trybi. Mój kod wygląda Kod <?php $only_func = 1; include "../matrix.php"; define('FPDF_FONTPATH','font/'); //definiuje katalog z czcionkami komponentu require('fpdf.php'); //odniesienie do skryptu komponentu $pdf = new FPDF(); $pdf->Open(); //otwiera nowy dokument $pdf->AcceptPageBreak(); $pdf->SetAutoPageBreak(true,20); $pdf->AddPage(); //dodaje now± stronę do dokumentu $pdf->AddFont('arialpl','','arialpl.php'); //dodaje Twoj± czcionkę arialpl do dokumentu $pdf->SetFont('arialpl','',30); //ustawia czcionkę arialpl, rozmiar 20 $pdf->Text(10,10, 'Zamówienia'); $pdf->SetFont('arialpl','',10); $pdf->Text(10,13, 'z dnia '.date("Y-m-d",time())); $values = $_POST['czek']; $igrek = 5; for ($i=0;$i<=count($values)-1;$i++){ $igrek = $igrek+15; $pdf->Line(0, $igrek,250, $igrek); $igrek++; $pdf->Line(0, $igrek,250, $igrek); $igrek = $igrek + 4; $req=dbarray(dbquery("SELECT * FROM st_order WHERE id=".$values[$i])); $pdf->text(10,$igrek,"Zamówienie nr. ".$req['number']." Data: ".date("Y-m-d H:i",strtotime($req['created_at']))); $pdf->text(120,$igrek,"Pakował: "); $pdf->Line(135, $igrek,170, $igrek); $igrek = $igrek + 7; $xlp = 11; $xkod = 17; $xilosc = 52; $xpole1=60; $xpole2=70; $xnazwa = 80; $xcena = 175; $xwartosc = 188; $xkoniec = 200; $pdf->Line($xlp-1, $igrek-3,$xkoniec, $igrek-3); $pdf->text($xlp,$igrek,"Lp."); $pdf->text($xnazwa,$igrek,"Nazwa"); $pdf->text($xkod,$igrek,"KOD"); $pdf->text($xilosc,$igrek,"SZT"); //$pdf->text($xcena,$igrek,"CENA"); //$pdf->text($xwartosc,$igrek,"WART"); $pdf->text($xpole1,$igrek,"SP"); $pdf->text($xpole2,$igrek,"POP"); $igrek = $igrek + 2; $pdf->Line($xlp-1, $igrek,$xkoniec, $igrek); $start_from_top=$igrek-5; $sub_req=dbquery("SELECT * FROM st_order_product WHERE order_id=".$values[$i]); $j=0; $igrek=$igrek+4; $price=0; //tworze zmiennej odpowiadającej za podsumowanie kosztów zamowienia while ($row=dbarray($sub_req)) { $$volume_items++; $j++; //skracanie nazwy jezeli zbyt dluga $pdf->text($xlp,$igrek, $j); $nazwa=$row['name']; $volume_nazwa=strlen($nazwa); if ($volume_nazwa>74){ $nazwa=substr($nazwa,0,72); $nazwa=$nazwa."..."; } $pdf->text($xnazwa,$igrek,$nazwa); //skracanie kodu jezeli zbyt dlugi $code=$row['code']; $volume_code=strlen($code); if ($volume_code>15){ $code=substr($code,0,14); $code=$code."..."; } $pdf->text($xkod,$igrek,$code); $pdf->text($xilosc,$igrek,$row['quantity']); //$pdf->text($xcena,$igrek,$row['price_brutto']); //$pdf->text($xwartosc,$igrek,$row['price_brutto']*$row['quantity']); $igrek = $igrek + (1*$line_count); $pdf->Line($xlp-1, $igrek+1,$xkoniec, $igrek+1); $igrek=$igrek+5; $price=$price+$row['price_brutto']*$row['quantity']; } $igrek=$igrek-4; $xlp--; $xnazwa--; $xkod--; $xilosc--; $xcena--; $xwartosc--; $xpole1--; $xpole2--; //Linie pionowe tabeli produktow $pdf->Line($xlp, $start_from_top,$xlp, $igrek);//Przed L.P. $pdf->Line($xnazwa, $start_from_top,$xnazwa, $igrek);//Przed Nazwą $pdf->Line($xkod, $start_from_top,$xkod, $igrek);//Przed Kodem $pdf->Line($xilosc, $start_from_top,$xilosc, $igrek);//Przed Ilością //$pdf->Line($xcena, $start_from_top,$xcena, $igrek);//Przed Ceną //$pdf->Line($xwartosc, $start_from_top,$xwartosc, $igrek);//Przed wartoscia $pdf->Line($xkoniec, $start_from_top,$xkoniec, $igrek);//Na koncu $pdf->Line($xpole1, $start_from_top,$xpole1, $igrek);//Przed Pole1 $pdf->Line($xpole2, $start_from_top,$xpole2, $igrek);//Przed Pole2 $delivery=dbarray(dbquery("SELECT * FROM st_order_delivery WHERE id=".$values[$i])); $delivery=dbarray(dbquery("SELECT * FROM st_order_delivery WHERE id=".$values[$i])); $igrek=$igrek+5; $delivery_cost=$delivery['cost_brutto']; $pdf->text(160,$igrek,"Koszt wysyłki: ".$delivery_cost."zł"); $igrek=$igrek+5; $price=$price+$delivery_cost; //$pdf->text(160,$igrek,"Suma: ".$price); $igrek=$igrek-5; $pdf->text(10,$igrek,"Sposób wysyłki: ".$delivery['name']); $y=$igrek; $pdf->text(160,$igrek,"Koszt wysyłki: ".$delivery_cost."zł"); } $pdf->Output(); //zamyka i generuje dokument ?> Czemu to nie działa? |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 14.08.2025 - 01:51 |