change code for special charachter in fpdf

This commit is contained in:
Claudio 2024-09-23 11:03:30 +02:00
parent 11954159d4
commit ffe49ac328
3 changed files with 38 additions and 43 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1,9 +1,8 @@
<?php <?php
//invoice contacts //invoice contacts
// ***start with invoice address // ***start with invoice address
$pdf->SetFont('', '', 8); $pdf->SetFont('', '', 8);
$pdf->Cell(90, 6, $certificationtypedtitle, 1, 0, 'C'); $pdf->Cell(90, 6, iconv('UTF-8', 'windows-1252', $certificationtypedtitle), 1, 0, 'C');
$pdf->SetFillColor(232, 242, 255); $pdf->SetFillColor(232, 242, 255);
$certificationtyped = $trfData['certificationtyped']; $certificationtyped = $trfData['certificationtyped'];
@ -26,7 +25,7 @@ switch ($certificationtyped) {
} }
// Inserisci la label corretta nel PDF // Inserisci la label corretta nel PDF
$pdf->Cell(100, 6, $certificationtyped_label, 1, 0, 'C', TRUE); $pdf->Cell(100, 6, iconv('UTF-8', 'windows-1252', $certificationtyped_label), 1, 0, 'C', TRUE);
$pdf->Ln(); $pdf->Ln();
$pdf->Ln(); $pdf->Ln();
@ -38,8 +37,7 @@ $contactsinfo = mysqli_query($cmctrfdb, "SELECT * FROM contacts WHERE contacts.i
$pdf->SetFont('Arial', '', 8); $pdf->SetFont('Arial', '', 8);
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', 'B', '10'); $pdf->SetFont('', 'B', '10');
$audititletop = html_entity_decode($auditplacepdf, ENT_QUOTES, 'UTF-8'); $audititletop = iconv('UTF-8', 'windows-1252', html_entity_decode($auditplacepdf, ENT_QUOTES, 'UTF-8'));
$audititletop = iconv('UTF-8', 'windows-1252', $audititletop);
$pdf->Cell(190, 6, $audititletop, 1, 0, 'C'); $pdf->Cell(190, 6, $audititletop, 1, 0, 'C');
$pdf->Ln(); $pdf->Ln();
@ -48,11 +46,11 @@ $sitenumber = 1;
// Verifica se ci sono dati e itera su ogni record // Verifica se ci sono dati e itera su ogni record
while ($contactsinfoData = mysqli_fetch_assoc($contactsinfo)) { while ($contactsinfoData = mysqli_fetch_assoc($contactsinfo)) {
$companyname = html_entity_decode($contactsinfoData['companyname'], ENT_QUOTES, 'UTF-8'); $companyname = iconv('UTF-8', 'windows-1252', html_entity_decode($contactsinfoData['companyname'], ENT_QUOTES, 'UTF-8'));
// Titolo per ogni sede con numero sequenziale // Titolo per ogni sede con numero sequenziale
$pdf->SetFont('Arial', '', 10); $pdf->SetFont('Arial', '', 10);
$pdf->Cell(190, 6, $sitentitle . " " . $sitenumber, 1, 0, 'C'); $pdf->Cell(190, 6, iconv('UTF-8', 'windows-1252', $sitentitle) . " " . $sitenumber, 1, 0, 'C');
$pdf->Ln(); $pdf->Ln();
$sitenumber++; // Incrementa il numero sequenziale per ogni sede $sitenumber++; // Incrementa il numero sequenziale per ogni sede
@ -60,32 +58,32 @@ while ($contactsinfoData = mysqli_fetch_assoc($contactsinfo)) {
// Stampa dei dati aziendali // Stampa dei dati aziendali
$pdf->SetFont('Arial', '', 8); $pdf->SetFont('Arial', '', 8);
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$pdf->Cell(40, 6, html_entity_decode($companypdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $companypdf), 1, 0, 'C');
$pdf->SetFillColor(232, 242, 255); $pdf->SetFillColor(232, 242, 255);
$pdf->Cell(150, 6, $companyname, 1, 0, 'C', TRUE); $pdf->Cell(150, 6, $companyname, 1, 0, 'C', TRUE);
$pdf->Ln(); $pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($addresspdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $addresspdf), 1, 0, 'C');
$pdf->Cell(150, 6, html_entity_decode($contactsinfoData['address'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE); $pdf->Cell(150, 6, iconv('UTF-8', 'windows-1252', html_entity_decode($contactsinfoData['address'], ENT_QUOTES, 'UTF-8')), 1, 0, 'C', TRUE);
$pdf->Ln(); $pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($citypdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $citypdf), 1, 0, 'C');
$pdf->Cell(55, 6, html_entity_decode($contactsinfoData['city'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE); $pdf->Cell(55, 6, iconv('UTF-8', 'windows-1252', html_entity_decode($contactsinfoData['city'], ENT_QUOTES, 'UTF-8')), 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($zippdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $zippdf), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['cap'], 1, 0, 'C', TRUE); $pdf->Cell(55, 6, $contactsinfoData['cap'], 1, 0, 'C', TRUE);
$pdf->Ln(); $pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($vatpdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $vatpdf), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['piva'], 1, 0, 'C', TRUE); $pdf->Cell(55, 6, $contactsinfoData['piva'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($countrypdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $countrypdf), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['country'], 1, 0, 'C', TRUE); $pdf->Cell(55, 6, $contactsinfoData['country'], 1, 0, 'C', TRUE);
$pdf->Ln(); $pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($phonepdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $phonepdf), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['telephone'], 1, 0, 'C', TRUE); $pdf->Cell(55, 6, $contactsinfoData['telephone'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($emailpdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $emailpdf), 1, 0, 'C');
$pdf->Cell(55, 6, html_entity_decode($contactsinfoData['email'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE); $pdf->Cell(55, 6, iconv('UTF-8', 'windows-1252', html_entity_decode($contactsinfoData['email'], ENT_QUOTES, 'UTF-8')), 1, 0, 'C', TRUE);
$pdf->Ln(); $pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($contactnamepdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $contactnamepdf), 1, 0, 'C');
$pdf->Cell(55, 6, html_entity_decode($contactsinfoData['contactname'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE); $pdf->Cell(55, 6, iconv('UTF-8', 'windows-1252', html_entity_decode($contactsinfoData['contactname'], ENT_QUOTES, 'UTF-8')), 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($contactsurnamepdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $contactsurnamepdf), 1, 0, 'C');
$pdf->Cell(55, 6, html_entity_decode($contactsinfoData['contactsurname'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE); $pdf->Cell(55, 6, iconv('UTF-8', 'windows-1252', html_entity_decode($contactsinfoData['contactsurname'], ENT_QUOTES, 'UTF-8')), 1, 0, 'C', TRUE);
$pdf->Ln(); $pdf->Ln();
// Calcola il totale delle persone // Calcola il totale delle persone
@ -97,51 +95,48 @@ while ($contactsinfoData = mysqli_fetch_assoc($contactsinfo)) {
$contactsinfoData['salesperson'] + $contactsinfoData['salesperson'] +
$contactsinfoData['projectperson']; $contactsinfoData['projectperson'];
// Stampa dei campi aggiuntivi in modo compatto con label (colonna_title) senza grassetto // Stampa dei campi aggiuntivi in modo compatto con label (colonna_title) senza grassetto
$pdf->Cell(40, 6, html_entity_decode($activitiestitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $activitiestitle), 1, 0, 'C');
$pdf->Cell(150, 6, html_entity_decode($contactsinfoData['activities'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE); $pdf->Cell(150, 6, iconv('UTF-8', 'windows-1252', html_entity_decode($contactsinfoData['activities'], ENT_QUOTES, 'UTF-8')), 1, 0, 'C', TRUE);
$pdf->Ln(); $pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($designtitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $designtitle), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['projectperson'], 1, 0, 'C', TRUE); $pdf->Cell(55, 6, $contactsinfoData['projectperson'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($salestitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $salestitle), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['salesperson'], 1, 0, 'C', TRUE); $pdf->Cell(55, 6, $contactsinfoData['salesperson'], 1, 0, 'C', TRUE);
$pdf->Ln(); $pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($productiontitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $productiontitle), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['productionperson'], 1, 0, 'C', TRUE); $pdf->Cell(55, 6, $contactsinfoData['productionperson'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($customer_caretitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $customer_caretitle), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['csperson'], 1, 0, 'C', TRUE); $pdf->Cell(55, 6, $contactsinfoData['csperson'], 1, 0, 'C', TRUE);
$pdf->Ln(); $pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($qualitytitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $qualitytitle), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['qualityperson'], 1, 0, 'C', TRUE); $pdf->Cell(55, 6, $contactsinfoData['qualityperson'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($purchasestitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $purchasestitle), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['purchaseperson'], 1, 0, 'C', TRUE); $pdf->Cell(55, 6, $contactsinfoData['purchaseperson'], 1, 0, 'C', TRUE);
$pdf->Ln(); $pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($other_activitytitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $other_activitytitle), 1, 0, 'C');
$pdf->Cell(55, 6, html_entity_decode($contactsinfoData['otheractivities'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE); $pdf->Cell(55, 6, iconv('UTF-8', 'windows-1252', html_entity_decode($contactsinfoData['otheractivities'], ENT_QUOTES, 'UTF-8')), 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($other_activitypersontitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $other_activitypersontitle), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['otheractivitiesperson'], 1, 0, 'C', TRUE); $pdf->Cell(55, 6, $contactsinfoData['otheractivitiesperson'], 1, 0, 'C', TRUE);
$pdf->Ln(); $pdf->Ln();
// Stampa il campo Total Persons // Stampa il campo Total Persons
$pdf->Cell(60, 6, html_entity_decode($totalpersontitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(60, 6, iconv('UTF-8', 'windows-1252', $totalpersontitle), 1, 0, 'C');
$pdf->Cell(130, 6, $totalperson, 1, 0, 'C', TRUE); // Campo "Total Persons" $pdf->Cell(130, 6, $totalperson, 1, 0, 'C', TRUE); // Campo "Total Persons"
$pdf->Ln(); $pdf->Ln();
$pdf->Cell(60, 6, html_entity_decode($language_audittitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(130, 6, html_entity_decode($contactsinfoData['languageforaudit'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE); $pdf->Cell(60, 6, iconv('UTF-8', 'windows-1252', $language_audittitle), 1, 0, 'C');
$pdf->Cell(130, 6, iconv('UTF-8', 'windows-1252', html_entity_decode($contactsinfoData['languageforaudit'], ENT_QUOTES, 'UTF-8')), 1, 0, 'C', TRUE);
$pdf->Ln(); $pdf->Ln();
$pdf->Cell(60, 6, html_entity_decode($outsourced_processestitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C'); $pdf->Cell(60, 6, iconv('UTF-8', 'windows-1252', $outsourced_processestitle), 1, 0, 'C');
$pdf->Cell(130, 6, html_entity_decode($contactsinfoData['outsourcing_process'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE); $pdf->Cell(130, 6, iconv('UTF-8', 'windows-1252', html_entity_decode($contactsinfoData['outsourcing_process'], ENT_QUOTES, 'UTF-8')), 1, 0, 'C', TRUE);
$pdf->Ln(); $pdf->Ln();
// Spazio vuoto tra i dati delle aziende // Spazio vuoto tra i dati delle aziende
$pdf->Ln(6); $pdf->Ln(6);
} }
?>