<?php

	$table_name67="Aprocess2";
	$table_name100="signin2";
	$table_name101="sig_map";
	$table_name102="sig_map_text";
	include("../../../admin/GoTool/cat.inc");
	$connection = @mysqli_connect($host,$user,$password) or die(mysqli_error($connection));
	$db = @mysqli_select_db($connection,$db_name) or die(mysqli_error($connection));
	     
	 $log=$_POST['log'];

	$map_id=$_POST['map_id'];
	//$map_id='';
	$map_id55=$map_id;
	
	 $sql33 ="SELECT name FROM $table_name80 WHERE map_id = '$map_id' ";
	  $result33 = @mysqli_query($connection,$sql33) or die(mysqli_error($connection));
	        $row22 =mysqli_fetch_array($result33,MYSQLI_ASSOC);
	          $survey_idR=  $row22['survey_id'];
	
	
	

	 $sq112ab="SELECT * FROM $table_name81 WHERE survey_id = '$survey_idR'";
	$result222a = @mysqli_query($connection,$sq112ab) or die(mysqli_error($connection));
	while ($row1ab = mysqli_fetch_array($result222a)) {
	$survey_id=  $row1ab['survey_id'];
	  $stitle=   stripslashes($row1ab['name']);
	          }

	$survey_num=$survey_id;

	//  $stitle=stripslashes($_POST['stitle77']);


	$summary77="Survey: $stitle";
	$author1="GalliumGroup";
	$title1 ="Sample PDF Document";
	$subj1="Public Document";
	$key1="Keywords, PDF, User Docs";
	$today = date("Y-m-d h:i:s");
	$Rtoday=$today;
	$map_title=date("Ymshis");

	//$map_id=$_GET['map_id'];
	//if ($map_id==$blink){
	//$map_id=$_POST['map_id'];
	//}



	$sq112a="SELECT * FROM $table_name76 WHERE survey_id ='$survey_idR' ORDER BY surveyQ_idK ASC, surveyQ_id ASC ";


	//include("../../../admin/GoTool/survey/surv_display2.php");

	//$utf8text=$display_blockAdminB;


	 $sack=stripslashes($_POST['sack']);
	   //$good1=$_POST['good1'];
	   // $pic88=$_POST['pic88'];
	   // $pic88="../../../admin/GoTool/survey_MIT/$pic88";
	 //    $stuff88="$good1.txt";
	  //$sack=1;

	 $a312="Assessment";
	//$a312=date("Ymshis");
	 //     $email=stripslashes($_POST['email']);
	 // $c_email=stripslashes($_POST['c_email']);
	  $fname=stripslashes($_POST['fname']);
	   $lname=stripslashes($_POST['lname']);
	//   $company=stripslashes($_POST['company']);

	    




	//============================================================+
	//
	//
	//
	//string   	$name   	The name of the file when saved. Note that special characters are removed and blanks characters are replaced with the underscore character.
	//string   	$dest   	Destination where to send the document. It can take one of the following values:

	//    I: send the file inline to the browser (default). The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.
	//    D: send to the browser and force a file download with the name given by name.
	//    F: save to a local server file with the name given by name.
	//    S: return the document as a string. name is ignored.
	//    FI: equivalent to F + I option
	//    FD: equivalent to F + D option
	//============================================================+



	//require_once('../config/lang/eng.php');
	//require_once('../tcpdf.php');
	require_once('tcpdf_include.php');    

	// create new PDF document
	$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

	// set document information
	$pdf->SetCreator(PDF_CREATOR);
	$pdf->SetAuthor("$author1");
	$pdf->SetTitle("$title1");
	$pdf->SetSubject("$subj1");
	$pdf->SetKeywords("$keys1");

	// set default header data
	//$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING);
	$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, "Document - $a312", PDF_HEADER_STRING);

	// set header and footer fonts
	$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
	$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

	// set default monospaced font
	$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

	//set margins
	$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
	$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
	//$pdf->setLanguageArray($l);

	if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
	    require_once(dirname(__FILE__).'/lang/eng.php');
	    $pdf->setLanguageArray($l);
	}


	// ---------------------------------------------------------

	// set default font subsetting mode
	//$pdf->setFontSubsetting(true);
	$pdf->setFontSubsetting(false);

	// Set font
	// dejavusans is a UTF-8 Unicode font, if you only need to
	// print standard ASCII chars, you can use core fonts like
	// helvetica or times to reduce file size.
	//$pdf->SetFont('dejavusans', '', 14, '', true);
	$pdf->SetFont('dejavusans', '', 10, '', false);

	// Add a page
	// This method has several options, check the source code documentation for more information.
	$pdf->AddPage();
	 //<h1>Welcome to <a href="http://www.tcpdf.org" style="text-decoration:none;color:black;"><span style="background-color:#CC0000;"> TC<span style="color:white;">PDF</span> </span></a>!</h1>

	// set JPEG quality
	//$pdf->setJPEGQuality(75);

	// Image method signature:
	// Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false)


	// get esternal file content
	//$utf8text = file_get_contents("$stuff88", false);
	//$utf8text = file_get_contents("$stuff88");
	//echo "$utf8text"; ’
	$prob55="’";
	$fix55="'";
	//$utf8text=str_replace($prob55,$fix55,$utf8text);
	//echo "$utf8text";

	//$utf8text = iconv('UTF-8', 'ASCII//TRANSLIT', $utf8text); 
	$utf8text = str_replace(chr(130), ',', $utf8text);  
	$utf8text = str_replace(chr(146), "'", $utf8text);    // right single quote
	$utf8text = str_replace(chr(147), '"', $utf8text);    // left double quote
	$utf8text = str_replace(chr(132), '"', $utf8text);    // baseline double quote
	$utf8text = str_replace(chr(133), '...', $utf8text);  // ellipsis
	$utf8text = str_replace(chr(145), "'", $utf8text);    // left single quote
	$utf8text = str_replace(chr(148), '"', $utf8text);    // right double quote

	$utf8text = mb_convert_encoding($utf8text, 'HTML-ENTITIES', 'UTF-8');


	$pdf->Write(0, "$summary77", '', 0, 'L', true, 0, false, false, 0);

	$pdf->SetFont('helvetica', '', 8);

	//$pdf->Image("$good1", 15, 140, 75, 113, 'JPG', 'http://www.tcpdf.org', '', true, 150, '', false, false, 1, false, false, false);
	// Set some content to print
	$html = <<<EOF
	 $utf8text
	EOF;

	// Print text using writeHTMLCell()
	//writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align='')
	//$pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=1, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);

	//$pdf->Write(15, $utf8text, '', 0, '', false, 0, false, false, 0);
	//$pdf->writeHTML($html, true, 0, true, 0);
	//$pdf->writeHTML($html, true, false, false,false, 0);
	//$pdf->writeHTML($utf8text, true, false, true, false, '');
	$pdf->writeHTML($html, true, 0, true, 0);

	// set JPEG quality
	$pdf->setJPEGQuality(75);

	// Image method signature:
	// $pdf->Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false)
	//$pdf->Image($pic88, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false);


	// reset pointer to the last page
	$pdf->lastPage();

	// ---------------------------------------------------------

	// Close and output PDF document
	// This method has several options, check the source code documentation for more information.
	$pdf->Output("$a312.pdf", 'FD');

	//header('Location:https://411webhost.com/guest_forms/download.html');
	//============================================================+
	// END OF FILE
	//============================================================+
	
?>