Jump to content

Search the Community

Showing results for tags 'tcpdf'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 5 results

  1. Hi all, I am trying to get data from MySQL to display in a html table in TCPDF but it is only displaying the ID. $accom = '<h3>Accommodation:</h3> <table cellpadding="1" cellspacing="1" border="1" style="text-align:center;"> <tr> <th><strong>Organisation</strong></th> <th><strong>Contact</strong></th> <th><strong>Phone</strong></th> </tr> <tbody> <tr>'. $id = $_GET['id']; $location = $row['location']; $sql = "SELECT * FROM tours WHERE id = $id"; $result = $con->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { '<td>'.$location.'</td> <td>David</td> <td>0412345678</td> </tbody>'; } } '</tr> </table>'; Anyone got any ideas?
  2. I am new in php programming and I have develop php script using TCPDF libary that takes data from pdf form fields and create flatten copy of that PDF using TCPDF , after that I use "AttachMailer.php" to send copies of PDF to client and customer, when user fill pdf form and click submit button flatten copy of that pdf is created in wp-content/uploads/pdf folder , and email code gets same copy fro wp-content/uploads/pdf folder and copy is forwarded to client and customer once copies are forwarded, it should show message "email has been sent.....email-address". // =============Email Form=============================== require_once(dirname(__FILE__)."/AttachMailer.php"); $mailer = new AttachMailer($Email, $Email, "Submitted Form Copy", "hello <b>Please Find the Attached Copy of form sumitted</b>"); $mailer->attachFile($fpath.$Contact_Name.'_'.$Email.$fID); $mailer1 = new AttachMailer($Email,$CEmail, "CC for client Submitted Form ", "hello <b>Please Find the Attached Copy of form sumitted by </b>".$Contact_Name); $mailer1->attachFile($fpath.$Contact_Name.'_'.$Email.$fID); if($mailer->send()) { echo "Email has been sent to ".$Email."\n and" ; } else{ echo "error in email\n"; exit(); } if($mailer1->send()){ echo "\nCC has been sent to ".$CEmail ; } else{echo "\nerror in email CC was not sent to ".$CEmail;}! the problem is that when user click submit button he/or she is redirected to home page (which i dont want)with executing if and else statements in email code shown above please help me how can I stop redirecting to home page. you can see screenshot of redirected page from my dropbox https://www.dropbox.com/s/t48rqemujn21q42/redirectpagescreenshot.png?dl=0
  3. Hi all! I'm new here, apologies that my 1st post will be a cry for help. I'm tearing my hair out with this one. I've got this page that generates PDF's via TCPDF plugin http://www.kinho.com/lightbox/ whenever I view it in chrome it zooms in at 100% to the top left corner. The problem is I need the images to be large and suitable to print (7"x5" or thereabouts) and so the PDF isn't built to be viewed at 100%, it just looks too zoomed in. Every other browser respects the fit to width setting. My images are 1600px on their long side, pages are landscape. here's the create.php:https://dl.dropboxusercontent.com/u/14123055/PHP/create.php Can anybody advise a workaround for chrome? many thanks! badger
  4. Hi everyone I'm trying to generate a pdf file using TCPDF through a foreach loop. My problem is that its only generating the first entry in the array and not the second. (I'm doing this through MODx) <?php ini_set("display_errors", 1); $action = $_REQUEST['action']; switch($action) { case "generate_pdf": $id = (int) $_POST['id']; $html =''; require_once( $modx->config['base_path'].'/assets/tcpdf/examples/tcpdf_include.php'); // create new PDF document $pdf = new TCPDF('L', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Focus on Health'); $pdf->SetTitle('CPD Activity Record'); $pdf->SetSubject('CPD Activity Record'); $pdf->SetKeywords('CPD, Activity, Record'); // remove default header/footer $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(5, 5, 5); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) if (@file_exists($modx->config['base_path'].'/assets/tcpdf/lang/eng.php')) { require_once($modx->config['base_path'].'/assets/tcpdf/lang/eng.php'); $pdf->setLanguageArray($l); } // --------------------------------------------------------- // set font $pdf->SetFont('helvetica', '', 9); $pdf->AddPage(); $html .= '<h1>Number of Active CEU's</h1>'; $ik = 1; $gr_arr = array(1=>'CLINICAL CEU\'S',2=>'ETHICS CEU\'S'); $data = array(); foreach($gr_arr as $group_id => $group_title){ $level1_total = 0; $level2_total = 0; $level3_total = 0; $sql = "SELECT c.*,uc.certificate_file FROM foh_conferences c LEFT JOIN foh_users_certification uc ON c.attachment_id=uc.id WHERE c.user_id = '".$_POST["id"]."' AND group_id = '".$group_id."' and (conference_accured + INTERVAL 2 YEAR) > NOW();"; $query = new xPDOCriteria($modx, $sql); $query->prepare(); $query->stmt->execute(); $data["conferences"] = array(); $conferences = array(); while($row = $query->stmt->fetch(PDO::FETCH_OBJ)) { $conferences[] = $row; $data["conferences"][] = $row; } /*$html .= '<pre>'; var_dump($conferences); $html .= '</pre>';*/ $sql2 = "SELECT e.*, e.exam_id AS renew_exam_id,s.title,s.show_level,a.pass_marks,a.total_marks,a.stotalmarks,s.accreditation_number,s.short_description, s.description,a.finished,g.title,s.number_ceu,s.group_clinical,s.group_ethics,s.date_accured,s.date_valid FROM foh_exams e INNER JOIN foh_survey s ON s.sid=e.sid LEFT JOIN foh_professions g ON s.sid = g.id INNER JOIN foh_answers a ON a.a_id=e.aid WHERE e.user_id = '".$_POST["id"]."'"; $query2 = new xPDOCriteria($modx, $sql2); $query2->prepare(); $query2->stmt->execute(); $data["exams"] = array(); $exams = array(); while($row2 = $query2->stmt->fetch(PDO::FETCH_OBJ)) { $exams[] = $row2; $data["exams"][] = $row2; } $ik++; $data["group_name"] = $group_title; $data["key"] = $group_id; /*$html .= '<pre>'; var_dump($data); $html .= '</pre>';*/ $html .= '<table cellpadding="3" cellspacing="0" border="0" style="border:1px solid #ccc;width:960px" class="ui-widget ui-corner-all"> <tr> <td colspan="9" style="text-align:center" class="ui-widget-header"> <h3>TOTAL '.$data["group_name"].'</h3> </td> </tr> <tr> <td rowspan="2" class="ui-widget-header" bgcolor="#cccccc">Name of provider</td> <td rowspan="2" class="ui-widget-header" bgcolor="#cccccc">Descriptions Of Activity</td> <td rowspan="2" class="ui-widget-header" bgcolor="#cccccc" width="100">Accreditation Number</td> <td rowspan="1" class="ui-widget-header" colspan="2" bgcolor="#cccccc">Date</td> <td rowspan="2" class="ui-widget-header" colspan="1" bgcolor="#cccccc">Level1</td> <td rowspan="2" class="ui-widget-header" colspan="1" bgcolor="#cccccc">Level2</td> <td rowspan="2" class="ui-widget-header" bgcolor="#cccccc">Level3</td> <td rowspan="2" class="ui-widget-header" bgcolor="#cccccc">Total</td> </tr> <tr> <td bgcolor="#cccccc" class="ui-widget-header">Date Accrued</td> <td bgcolor="#cccccc" class="ui-widget-header">Date Valid</td> </tr>'; foreach($data["exams"] as $exam) { if(($exam->status == 'failed'||$exam->status == 'completed') && (($exam->group_clinical==1 && $data["key"]==1) || ($exam->group_ethics==1 && $data["key"]==2)) ) { $html .= '<tr> <td>'.$exam->title.'</td> <td>'.$exam->short_description.'</td> <td>'.$exam->accreditation_number.'</td> <td align="center">'.($exam->status == 'completed'||$exam->status == 'failed'?date('Y/m/d',strtotime($exam->date_accured.'')):'----/--/--').'</td> <td align="center">'.($exam->status == 'completed'||$exam->status == 'failed'?date('Y/m/d',strtotime($exam->date_valid)):'----/--/--').'</td> <td class="center_points">'; if($exam->status == 'completed' && $exam->show_level == 1) { $html .= $exam->number_ceu; $level1_total += $exam->number_ceu; }else{ $html .= '--'; } $html .= '</td> <td class="center_points">'; if($exam->status == 'completed' && $exam->show_level == 2) { $html .= $exam->number_ceu; $level2_total += $exam->number_ceu; }else{ $html .= '--'; } $html .= '</td> <td class="center_points">'; if($exam->status == 'completed' && $exam->show_level == 3) { $html .= $exam->number_ceu; $level3_total += $exam->number_ceu; }else{ $html .= '--'; } $html .= '</td> <td class="center_points">'; if($exam->status == 'completed') { $html .= $exam->number_ceu; }else{ $html .= '--'; } $html .= '</td> </tr>'; } } foreach($data["conferences"] as $conf) { if($conf->conference_accured != '0000-00-00') { $conference_accured = strtotime($conf->conference_accured.' +2 year -1 day'); if($conference_accured > mktime()) { $html .= '<tr> <td>'.$conf->conference_name.'</td> <td>'.$conf->conference_description; if($conf->attachment_id != 0) { $html .= '<br/> <a href="'.base_url().'uploaduser_certificate/'.$conf->certificate_file.'" target="_blank">View File</a>'; } $html .= '</td> <td>'.$conf->conference_number.'</td> <td>'; if($conf->conference_accured == '0000-00-00') { $html .= '----/--/--'; }else{ $html .= date('Y/m/d',strtotime($conf->conference_accured.'')); } $html .= '</td> <td>'; if($conf->conference_accured == '0000-00-00') { $html .= '----/--/--'; }else{ $html .= date('Y/m/d',strtotime($conf->conference_accured.' +2 year -1 day')); } $html .= '</td> <td class="center_points">'; if($conf->level == 1){ $html .= $conf->points; $level1_total += $conf->points; } $html .= '</td> <td class="center_points">'; if($conf->level == 2){ $html .= $conf->points; $level2_total += $conf->points; } $html .= '</td> <td class="center_points">'; if($conf->level == 3){ $html .= $conf->points; $level3_total += $conf->points; } $html .= '</td> <td class="center_points">'.$conf->points.'</td> </tr>'; } } } $html .= '<tr> <td><b>Total Points</b></td> <td> </td> <td> </td> <td> </td> <td> </td> <td class="center_points"><b>'.$level1_total.'</b></td> <td class="center_points"><b>'.$level2_total.'</b></td> <td class="center_points"><b>'.$level3_total.'</b</td> <td class="center_points"><b>'.($level1_total+$level2_total+$level3_total).'</b></td> </tr> <tr> <td><b>Points Lapsed</b></td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td><b>Total Valid Points</b></td> <td></td> <td></td> <td></td> <td></td> <td class="center_points"><b>'.$level1_total.'</b></td> <td class="center_points"><b>'.$level2_total.'</b></td> <td class="center_points"><b>'.$level3_total.'</b></td> <td class="center_points"><b>'.($level1_total+$level2_total+$level3_total).'</b></td> </tr>'; $html .= '</table><br /><br />'; $level1_total = 0; $level2_total = 0; $level3_total = 0; } unset($data); $pdf->writeHTML($html, true, 0, true, 0); $pdf->lastPage(); $filename = $modx->config['base_path'].'/assets/report/'.$_POST["id"].'-'.date("Y-m-d H:i:s").'.pdf'; $fileatt = $pdf->Output($filename, 'F'); $json = array("message" => $fileatt); echo $fileatt; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $fileatt1 = $filename; // Path to the file $fileatt_type = "application/pdf"; // File Type $fileatt_name = $_POST["id"]."-".date("Y-m-d H:i:s").".pdf"; // Filename that will be used for the file as the attachment $email_from = "sales@mysite.com"; // Who the email is from $email_subject = "Your attached file"; // The Subject of the email $email_message = "Here is your CPD Activity Report<br>"; $email_message .= "<br>"; // Message that the email has in it $email_to = ''; // Who the email is to $headers = "From: ".$email_from; $file = fopen($fileatt1,'rb'); $data = fread($file,filesize($fileatt1)); fclose($file); $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $email_message .= "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $email_message .= "\n\n"; $data = chunk_split(base64_encode($data)); $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data .= "\n\n" . "--{$mime_boundary}--\n"; $ok = @mail($email_to, $email_subject, $email_message, $headers); if($ok) { $message = "Your file was successfully created and has been sent\n to the appropriate email address specified.\n Make sure to check your junk mail!\n"; } else { $message = "Sorry but the email could not be sent. Please go back and try again!"; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// echo json_encode(array('message' => $message)); break; default: echo json_encode(array('message' => 'Unknown action')); break; } die();
  5. I have used TCPDF.But when i execute the first example "example_001.php",the pdf opens and displays only the header and footer.But the the HTML content doesn't get displayed.Please help.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.