Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it L'avatar di kodode
    Registrato dal
    Sep 2002
    Messaggi
    1,896

    catturare hmtl e convertirlo in PDF

    ciao a tutti!

    io mi sono creato diverse funzioni che mi costruisco il codice html della mia pagina e dopo la generazione di essa dovrei trasformarla in PDF. E naturalmente non funzia... allora ho provato a semplificare il codice per vedere se erano queste funzioni a creare problemi e nienrte quindi ho provato a fare una cosa ancora + semplice :

    Codice PHP:

    include $_SERVER['DOCUMENT_ROOT'] . "/funzioni.php" ;
    //INCLUSIONE E DEFIZIONE FILE PER CREAZIONE PDF
    define("FPDF_FONTPATH",$_SERVER['DOCUMENT_ROOT']."font/");
    require_once(
    $_SERVER['DOCUMENT_ROOT']."html2fpdf.php"); 


    //TABELLA PRINCIPALE
    $tabPRI  "" ;
    $tabPRI .= "<table width=990 border=0 cellspacing=0 cellpadding=4 align=center>" ;
    $tabPRI .= " <tr>" ;
    $tabPRI .= "  <td width=230 height=1></td>" ;
    $tabPRI .= "  <td width=230 height=1></td>" ;
    $tabPRI .= "  <td width=230 height=1></td>" ;
    $tabPRI .= "  <td width=300 height=1></td>" ;
    $tabPRI .= " </tr>" ;

    //LINEA
    $tabPRI .= " <tr><td colspan=4 height=2></td></tr>" ;
    $tabPRI .= " <tr><td colspan=4 height=1 bgcolor=#000000></td></tr>" ;
    $tabPRI .= " <tr><td colspan=4 height=2></td></tr>" ;

    //INTESTAZIONI DI COLONNA
    $tabPRI .= " <tr bgcolor=#CCCCFF>" ;
    $tabPRI .= "  <td class=txtnerb>Cognome</td>" ;
    $tabPRI .= "  <td class=txtnerb>Nome</td>" ;
    $tabPRI .= "  <td class=txtnerb>Telefono</td>" ;
    $tabPRI .= "  <td class=txtnerb>Citta</td>" ;
    $tabPRI .= " </tr>" ;

    //LINEA
    $tabPRI .= " <tr><td colspan=4 height=2></td></tr>" ;
    $tabPRI .= " <tr><td colspan=4 height=1 bgcolor=#000000></td></tr>" ;
    $tabPRI .= " <tr><td colspan=4 height=2></td></tr>" ;

    //LINEA
    $tabPRI .= " <tr><td colspan=4 height=2></td></tr>" ;
    $tabPRI .= " <tr><td colspan=4 height=1 bgcolor=#000000></td></tr>" ;
    $tabPRI .= " <tr><td colspan=4 height=2></td></tr>" ;

    //PAGING

    //SPAZIO
    $tabPRI .= " <tr><td colspan=4 height=5></td></tr>" ;

    //RIGA
    $tabPRI .= " <tr>" ;
    $tabPRI .= "  <td colspan=4 align=center>" ;
    $tabPRI .= "   <table width=600 border=0 cellspacing=0 cellpadding=2 align=center>" ;
    $tabPRI .= "    <tr>" ;
    $tabPRI .= "     <td width=400 align=center>Qui andrebbe l'estrazione da db" ;
    $tabPRI .= "     </td>" ;    
    $tabPRI .= "    </tr>" ;
    $tabPRI .= "   </table>" ;
    $tabPRI .= "  </td>" ;
    $tabPRI .= " </tr>" ;
    $tabPRI .= "</table>" ;

    ob_start();

    echo 
    $tabPRI ;

    //Output buffer in variable
    $PDFhtm ob_get_contents();


    //delete output buffer
    ob_end_clean();

    //CREAZIONE NUOVO OGGETTO FPDF
    $PDFper = new HTML2FPDF'l' ) ;
    $PDFper -> AddPage() ;
    $PDFper -> WriteHTML($PDFhtm);

    //OUTPUT AL BROWSER
    $PDFper -> output() ; 
    tanto per la cronaca... :
    -restituisce una pagina bianca
    -FPDF e compagnia(HTML2FPDF) funzionano perfettamente...

    grazie...

  2. #2
    Utente di HTML.it L'avatar di kodode
    Registrato dal
    Sep 2002
    Messaggi
    1,896
    il problema è che all'inizio della mia pagine faccio un

    include $_SERVER['DOCUMENT_ROOT'] . "/mie funzioni.php" ;

    e mi restuisce pagina vuota (bianca) o scrive non trovata..

    qualche idea?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.