Comments for One More Take https://www.onemoretake.com Sat, 01 Jun 2019 06:35:50 +0000 hourly 1 https://wordpress.org/?v=5.2.5 Comment on Revisited: Tcpdf – Variable Height Table Rows With MultiCell by Federico https://www.onemoretake.com/2009/03/27/revisited-tcpdf-variable-height-table-rows-with-multicell/comment-page-1/#comment-9312 Sat, 01 Jun 2019 06:35:50 +0000 http://www.onemoretake.com/?p=205#comment-9312 Utilizzando la funzione getNumLines che Dan ha suggerito e adattandola alle mie esigienze ho fatto in modo che le multicell di un documento pdf generato dall’estrazione di dati da Mysql adattasse l’altezza della cella a quella con maggior numero di righe di un record di una determinata riga.
Di seguito il codice commentato.

codice:
// qui le varie impostazioni del pdf
$pdf = new PDF(‘L’, ‘mm’, ‘A4’, true, ‘UTF-8’, false);
$pdf->SetMargins(5, 50, 5);
$pdf->SetAutoPageBreak(true, 8);
$pdf->AddPage();

// connessione al db
$conn_db = mysqli_connect($host, $username, $password, $database);

mysqli_set_charset($conn_db, “utf8”);

$result=mysqli_query($conn_db, “SELECT * FROM …..

$posizione_y=50; // posizione di start della prima multicell da stampare

while($row = mysqli_fetch_array($result)) { //eseguo il ciclo while per estrarre i dati interessati dal db

$id=$row[‘Id’];
$data=$row[‘Data’];
$ora=$row[‘Ora’];
$descrizione=$row[‘Descrizione’];
$ricambi=$row[‘Ricambi’];
$note=$row[‘Note’];

$h_cell_des = $pdf->getNumLines($descrizione, 90)*4; // recupero valore altezza cella descrizione
$h_cell_ricambi = $pdf->getNumLines($ricambi, 90)*4; // recupero valore altezza cella ricambi
$h_cell_note = $pdf->getNumLines($note, 90)*4; // recupero valore altezza cella note
// il 90 è la larghezza impostata della multicell
// il 4 è un numero che varia in base alla dimensione del carattere

$array = array($h_cell_des, $h_cell_ricambi, $h_cell_note); // inserisco le 3 o più variabili in un array

rsort($array); // ordino l’array dal maggiore al minore

$h_cell= $array[0]; // recupero il valore di quello maggiore

if($h_cell=200){
$posizione_y=50;
$pdf->AddPage();
}

// queste righe non hanno bisogno di commenti (notare solo $h_cell) come impostazione altezza multicell
$pdf->SetTextColor(0,0,0);
$pdf->SetFont(‘helvetica’,”,8);
$pdf->SetFillColor(255,255,255);
$pdf->MultiCell(10,$h_cell,$id, 1,’C’, true, 0, ”, ”, true, 0, false, false, 0, ‘M’, true);
$pdf->MultiCell(20,$h_cell,$data_it, 1, ‘C’, true, 0, ”, ”, true, 0, false, false, 0, ‘M’, true);
$pdf->MultiCell(90,$H_cell,$descrizione, 1,’L’, true, 0, ”, ”, true, 0, false, false, 0, ‘M’, true);
$pdf->MultiCell(90,$H_cell,$ricambi, 1,’L’, true, 0, ”, ”, true, 0, false, false, 0, ‘M’, true);
$pdf->MultiCell(90,$H_cell,$note, 1, ‘L’, true, 1, ”, ”, true, 0, false, false, 0, ‘M’, true);

$posizione_y=$posizione_y+$h_cell; // ricalcolo il valore di posizione_y e aggiungo il valore dell’altezza della multicell stampata
}

…..ecc.
Con questo sistema tutta la riga stampata ha l’altezza della cella che occupa più spazio in altezza e in più nel caso di più pagine, il salto pagina avviene non appena una cella non riesce a stare dentro la misura impostata della pagina. Si noterà infatti che l’ultima cella stampata su ogni pagina potrà avere una distanza diversa dal bordo inferiore.

Spero che il codice sia comprensibile.
Ciao
Federico

]]>
Comment on Revisited: Tcpdf – Variable Height Table Rows With MultiCell by php - TCPDF split html tableau sur plusieurs pages https://www.onemoretake.com/2009/03/27/revisited-tcpdf-variable-height-table-rows-with-multicell/comment-page-1/#comment-9202 Wed, 24 Apr 2019 06:28:38 +0000 http://www.onemoretake.com/?p=205#comment-9202 […] pris un coup d'oeil rapide à ces 2 articles, peut-être quelqu'un pourrait trouver cette pratique: Certains d'échange avec multicellulaire et Une autre pagination avec multicellulaire . J'ai trouvé ce 2 digne d'un exemple comme une […]

]]>
Comment on Revisited: Tcpdf – Variable Height Table Rows With MultiCell by JF Rullier https://www.onemoretake.com/2009/03/27/revisited-tcpdf-variable-height-table-rows-with-multicell/comment-page-1/#comment-8876 Tue, 13 Nov 2018 15:14:07 +0000 http://www.onemoretake.com/?p=205#comment-8876 Thank you !
I was using FPDF, and this feature is included.
You post helped me a lot to migrate to TCPDF.
JF Rullier.

]]>
Comment on Creating PDF Documents in PHP Using Tcpdf by Yashraj Waghe https://www.onemoretake.com/2009/02/28/creating-pdf-documents-in-php-using-tcpdf/comment-page-1/#comment-8737 Mon, 24 Sep 2018 20:46:41 +0000 http://www.onemoretake.com/?p=21#comment-8737 Hii
Can you please tell,
That can I use any website URL or Webpage as in TCPDF to get its PDF file….
I have a quotation making system, and i want it’s PDF, but my file having more PHP code so, it have been very difficult to me to take its PDF.
So can I get PDF from URL or iframe or by webpage…. if yes, so how ?

]]>
Comment on Creating PDF Documents in PHP Using Tcpdf by Bhavin https://www.onemoretake.com/2009/02/28/creating-pdf-documents-in-php-using-tcpdf/comment-page-1/#comment-8236 Mon, 04 Sep 2017 12:27:56 +0000 http://www.onemoretake.com/?p=21#comment-8236 Currently, we are working on HTML to pdf convert in PHP for printing material. According to printing standard, We can not use png in Html.

A Below listed plugin is not already tried to use .tiff images but most of the plugin convert tiff into jpg or not supported.

tcpdf
fpdf
Html2pdf
Dom pdf

Can you please suggest me if any plugin provides .tiff support in html 2 pdf?

]]>
Comment on Sorting Elements with jQuery by alberto https://www.onemoretake.com/2009/02/25/sorting-elements-with-jquery/comment-page-2/#comment-7475 Sat, 24 Sep 2016 12:16:58 +0000 http://www.onemoretake.com/?p=11#comment-7475 Thanks. I was looking for it

]]>
Comment on Sorting Elements with jQuery by nancie https://www.onemoretake.com/2009/02/25/sorting-elements-with-jquery/comment-page-2/#comment-7335 Mon, 04 Jul 2016 21:53:53 +0000 http://www.onemoretake.com/?p=11#comment-7335 Thnaks a lot !!! save me a lot of time !!

]]>
Comment on Sorting Elements with jQuery by Archäopath https://www.onemoretake.com/2009/02/25/sorting-elements-with-jquery/comment-page-2/#comment-7303 Fri, 10 Jun 2016 21:20:55 +0000 http://www.onemoretake.com/?p=11#comment-7303 A really clever solution! Many thanks!

]]>
Comment on Sorting Elements with jQuery by Mo https://www.onemoretake.com/2009/02/25/sorting-elements-with-jquery/comment-page-2/#comment-7270 Thu, 26 May 2016 14:51:47 +0000 http://www.onemoretake.com/?p=11#comment-7270 Duuuuuude!!! you just saved me $.hit(ton) of hours.
i was going to go down the rabbit whole of _.sort (lodash) but this is awesome 🙂
you rock

]]>
Comment on Revisited: Tcpdf – Variable Height Table Rows With MultiCell by Cleidson https://www.onemoretake.com/2009/03/27/revisited-tcpdf-variable-height-table-rows-with-multicell/comment-page-1/#comment-7226 Wed, 27 Apr 2016 03:25:36 +0000 http://www.onemoretake.com/?p=205#comment-7226 Veja o editor de relatório que desenvolvi usando a classe TCPDF.
https://www.youtube.com/watch?v=iKDmqMtaxcY

]]>