[RESOLU] mon application doit pourvoir imprimer tous ce qui est renseignés à partir de mon formulaire.

Petit nouveau ! | 2 Messages

14 juin 2020, 01:12

Mon sourcis ici est qu'il y a assez d'éléments donc ne peuvent pas contenir sur une seule page. j'arrive a afficher et imprimer la premiere pas mais je n'arrive pas à afficher et imprimer la suite mais tout a été inseré dans la base. j'utilise fpdf pour afficher la page pdf.
merci de m'aider svp.

Code : Tout sélectionner

<?php include("connexiondemande.php"); header('Content-type: text/html; charset=iso-8859-1'); ?> <?php include 'FPDF/FPDF/fpdf.php'; header("Content-Type: text/html; charset=utf-8"); class PDF extends FPDF { function header() { // Logo gauche $this->image('../images/logo.jpg',20,15); $this->Ln(30); // Police Arial gras 20 $this->SetFont('Arial','B',10); $this->text(8,10,utf8_decode('MON PROJET')); $this->text(10,49,'------------------------------------'); $this->text(15,52,' -----------------------------'); $this->text(22,55,'--------------------'); // Logo droite $this->image('../images/armoirie.jpg',237,15); $this->Ln(30); // Police Arial gras 20 $this->SetFont('Arial','B',10); $this->text(232,52,'UNION-DISCIPLINE-TRAVAIL'); $this->text(230,10,utf8_decode('REPUBLIQUE CÔTE D\'IVOIRE')); // Titre $this->Ln(4); $this->SetFont('Arial','B',12); // Décalage à droite $this->Cell(30); $this->Cell(215,9,'FICHE DE DEMANDE DE REPRISE D\'ACTIVITE',0,0,'C'); } function body() { $this->SetFont('Times','',12); //$pdf->cell(250,170,"",1,1,'C'); $this->text(10,90,'Raison sociale: '); $this->text(10,100,'Mail: '); $this->text(10,110,'Code: '); $this->text(10,120,'Marteau: '); $this->text(10,130,utf8_decode('Qualité:')); $this->text(10,140,utf8_decode('Nbre PEF 2021: ')); $this->text(10,150,utf8_decode('Périmètres et Localités: ')); $this->text(10,160,utf8_decode('Nom du Gérant: ')); $this->text(10,170,utf8_decode('Prenom du Gérant: ')); $this->text(10,180,'Adresse: '); $this->text(10,190,utf8_decode('Téléphone: ')); $this->text(10,200,'Fax: '); $this->text(10,210,'Forme juridique: '); $this->text(10,220,'Date de Creation: '); $this->text(10,230,'Capital Social: '); $this->text(10,240,utf8_decode('N° de compte contribuable: ')); $this->text(10,250,utf8_decode('N° De Registre de Commerce: ')); $this->text(10,260,utf8_decode('Situation Géographique: ')); $this->text(10,270,utf8_decode('chiffre d\'affaire au 31 octobre 2020 (exploitation forestière): ')); $this->text(10,280,'nombre de pef autorises en 2020: '); $this->text(10,290,'volume total exploite au 31 octobre 2020: '); $this->text(10,300,utf8_decode('décision d\'autorisation d\'exploiter le périmètre pour les nouveaux attributaires : ')); $this->text(10,310,utf8_decode('pv de la dernière assemblée générale, signe par tous les membres du groupement: ')); $this->text(10,320,utf8_decode('si oui, date de l\'assemblée générale: ')); $this->text(10,330,'bilan de l\'exploitation 2020: '); $this->text(10,340,utf8_decode('nombre de travailleurs intervenant sur le périmètre : ')); $this->text(10,350,'nombre de travailleurs nationaux: '); $this->text(10,360,'nombre de travailleurs non nationaux: '); $this->text(10,370,utf8_decode('attestation de fonctionnement de l\'usine délivrée par la DR : ')); $this->text(10,380,utf8_decode('attestation de reboisement délivrée par la DRCF : ')); $this->text(10,390,utf8_decode('attestation de non redevance délivrée par DAF : ')); $this->text(10,400,utf8_decode('reçus de paiement de la taxe d\'attribution et de superficie 2017, 2018, 2019 et 2020 : ')); $this->text(10,410,utf8_decode('déclaration de recettes et reçus de paiement taxes d\'abattage 2020 : ')); $this->text(10,420,utf8_decode('reçus de paiement des travaux d’intérêt général (tig) 2017, 2018, 2019, et 2020 : ')); $this->text(10,430,utf8_decode('déclaration de recettes et de reçus de paiement de la taxe spéciale : ')); $this->text(10,440,utf8_decode('reçus du paiement des frais d\'instruction 2020 : ')); $this->text(10,450,utf8_decode('pv de matérialisation des sommets datant moins d\'un (1) an : ')); $this->text(10,460,'si oui, date du pv: '); $this->text(10,470,utf8_decode('rapport de prospection des arbres a abattre au titre de l’année 2021 : ')); //$this->Cell(); } function ok() { $requete="select * from demandeligne "; $resultat=mysql_query($requete); while($data = mysql_fetch_array($resultat)) { //$data1 = $res1->fetch(PDO::FETCH_ASSOC); $rs=$data['raison']; $mai=$data['mail']; $co=$data['code']; $mart=$data['marteau']; $qual=utf8_decode($data['qualite']); $nbp21=$data['nbrpef21']; $ploc=$data['pefloc']; $ng=$data['nomg']; $pg=$data['prenomg']; $ad=$data['adresse']; $tel=$data['telephone']; $fa=$data['fax']; $fj=$data['formej']; $dtcre=$data['datecrea']; $cap=$data['capital']; $ncc=utf8_decode($data['NUMCC']); $nrc=$data['NUMRC']; $sgeo=$data['sitgeo']; $caf31=$data['CHAFF31']; $np20=$data['nbrpef20']; $ve31=$data['vte31']; $cdan=$data['ccdpapepefna']; $pvdag=$data['pvdagstmgr']; $dt=$data['date']; $be=$data['bilanExp']; $nbt=$data['nbrtra']; $ntn=$data['nbrenation']; $ntnn=$data['nbrnonnat']; $at=$data['attfuddr']; $att=$data['attrddrc']; $atdaf=$data['attnrdaf']; $drr=$data['drrptas']; $drpa=$data['drrpta']; $rti=$data['rptig']; $drpf=$data['drrptspdf']; $rpfi=$data['rpfidrata']; $pvpef=$data['pvmspef']; $dtpv=$data['datepv']; $rpa=$data['rpata']; $this->SetFont('Times','',15); } //$pdf->cell(250,170,"",1,1,'C'); $this->text(80,90,$rs); $this->text(80,100,$mai); $this->text(80,110,$co); $this->text(80,120,$mart); $this->text(80,130,utf8_decode($qual)); $this->text(80,140,$nbp21); $this->text(80,150,$ploc); $this->text(80,160,$ng); $this->text(80,170,$pg); $this->text(80,180,$ad); $this->text(80,190,$tel); $this->text(80,200,$fa); $this->text(80,210,$fj); $this->text(80,220,$dtcre); $this->text(80,230,$cap); $this->text(80,240,utf8_decode($ncc)); $this->text(80,250,$nrc); $this->text(80,260,$sgeo); $this->text(80,270,$caf31); $this->text(80,280,$np20); $this->text(80,290,$ve31); $this->text(80,300,$cdan); $this->text(80,310,$pvdag); $this->text(80,320,$dt); $this->text(80,330,$be); $this->text(80,340,$nbt); $this->text(80,350,$ntn); $this->text(80,360,$ntnn); $this->text(80,370,$at); $this->text(80,380,$att); $this->text(80,390,$atdaf); $this->text(80,400,$drr); $this->text(80,410,$drpa); $this->text(80,420,utf8_decode($rti)); $this->text(80,430,$drpf); $this->text(80,440,$rpfi); $this->text(80,450,$pvpef); $this->text(80,460,$dtpv); $this->text(80,470,$rpa); } function footer() { // Positionnement à 1,5 cm du bas $this->SetY(-15); // Police Arial italique 8 $this->SetFont('Arial','I',8); // Numéro de page $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); } } $pdf = new PDF(); for($page=1;$page<=4;$page++){ $pdf->AliasNbpages(); $pdf->AddPage(1); $pdf->body(); $pdf->body(); $pdf->ok(); } $pdf->SetFont('Arial','B',12); $pdf->SetTextColor(244,66,66); $pdf->text(12,310,'NB: Veuillez bien conserver le document imprimé.'); $pdf->SetFont('Arial','B',14); $pdf->SetTextColor(26,18,183); $pdf->text(55,300,'Merci et Bonne Chance a Vous!!! '); //ici je dois chercher comment changer la couleur en noir $pdf->SetTextColor(128); $pdf->Output(); ?> <html> <head> <meta charset="utf-8"/> </head> <html/>

Mammouth du PHP | 1967 Messages

15 juin 2020, 08:10

à ma connaissance, il faut que tu gère toi même l'ajout de la deuxième page.
Spols
pour les fan de rubik's cube ou pour les curieux ==> le portail francophone du rubik's cube

Mammouth du PHP | 881 Messages

29 juil. 2020, 23:34

Comme Spols, c'est toi qui dois insérer un saut de page.
FPDF t'offre cela tout cuit dans l'élément AddPage de son objet:

Ceci ajoutera une page identique à la précédente:
$this->AddPage();
Autrement, tu peux paramétrer la seconde page différemment de la première en complétant les options
$this->AddPage([string orientation [, mixed size [, int rotation]]]);
Dans ce cas, n'oublie pas que la troisième page reprendra la config de la 2e, il faudra alors répéter les config s'appliquant à la troisième.
Soyez artisans de paix

Avatar du membre
Administrateur PHPfrance
Administrateur PHPfrance | 9782 Messages

30 juil. 2020, 13:38

Par ailleurs, c'est curieux que tu mettes des balises HTML après $pdf->Output();
Quand tout le reste a échoué, lisez le mode d'emploi...