title: Converting xlsx to pdf using PHPExcel and download that pdf . work Fine on localhost
body: <p>This code works fine on localhost but on live server it shows</p>
  
  <blockquote>
    <p>File Not Found</p>
  </blockquote>
  
  <p>Check the file name for capitalization or other typing errors.
  Check to see if the file was moved, renamed or deleted.</p>
  
  <p>Here is my code </p>
  
  <p><strong>excel.php</strong></p>
  
  <pre><code>&lt;?php
  
  error_reporting(1);
  ini_set('display_errors', 0);
  ini_set('display_startup_errors', TRUE);
  
  $target = 'Myfile.xlsx';
  include 'phpexcel/Classes/PHPExcel/IOFactory.php';
  $inputFileType = PHPExcel_IOFactory::identify($target);
  
  function datefix_excel($excel) {
  
      $dif=(41885-$excel)*86400;
      $seconds=1409737670-$dif;
      $date=date("d/m/Y",$seconds);
      return $date; }
  
  //echo 'File ',pathinfo($inputFileName,PATHINFO_BASENAME),' has been identified as an ',$inputFileType,' file&lt;br /&gt;';
  
  //echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with the identified reader type&lt;br /&gt;';
  $objReader = PHPExcel_IOFactory::createReader($inputFileType);
  $objPHPExcel = $objReader-&gt;load($target);
  
  $i = 0;
  $found = false;
  try
  {
  
  
  
      //
      foreach ($objPHPExcel-&gt;getWorksheetIterator() as $worksheet) 
      {
  
      //
      //$objWorksheet = $objPHPExcel-&gt;getActiveSheet();
      //now do whatever you want with the active sheet
  
      $worksheet-&gt;setShowGridLines(false);
      $worksheet-&gt;getPageSetup()-&gt;setOrientation(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A2_PAPER );
      $worksheet-&gt;getPageSetup()-&gt;setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A2_PAPER );
      $worksheet-&gt;getPageSetup()-&gt;setFitToPage(true);
      $worksheet-&gt;getPageSetup()-&gt;setFitToWidth(1);
      $worksheet-&gt;getPageSetup()-&gt;setFitToHeight(0);
  
      $worksheet-&gt;getPageSetup()-&gt;setScale(40);
      $worksheet-&gt;getStyle('F1:F4')-&gt;getAlignment()-&gt;setWrapText(false);
      $worksheet-&gt;getStyle('D6:D8')-&gt;getAlignment()-&gt;setWrapText(false);
  
  
      $sheetData = $objPHPExcel-&gt;getActiveSheet()-&gt;toArray(null,true,true,true);
      $count = 0;
      $found == false;
  
      //
  
  $worksheetTitle     = $worksheet-&gt;getTitle();
  $highestRow         = $worksheet-&gt;getHighestRow(); // e.g. 10
  $highestColumn      = $worksheet-&gt;getHighestColumn(); // e.g 'F'
  $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
  $nrColumns = ord($highestColumn) - 64;
  for ($row = 1; $row &lt;= $highestRow; ++ $row) {
      for ($col = 0; $col &lt; $highestColumnIndex; ++ $col) {
          $cell = $worksheet-&gt;getCellByColumnAndRow($col, $row);
          $val = $cell-&gt;getValue();
  
              if($val==$_REQUEST['roll'])
              {
                  //echo "Roll Number found: ".$_REQUEST['roll']." &lt;br/&gt;";
                  $found = true;
                 // $objPHPExcel-&gt;getActiveSheet()-&gt;setCellValue('C23',$val);
                 $objPHPExcel-&gt;getActiveSheet()-&gt;setCellValue('C23',datefix_excel($objPHPExcel-&gt;getActiveSheet()-&gt;getCell('C23')-&gt;getValue()));
  
                  $rendererName = PHPExcel_Settings::PDF_RENDERER_DOMPDF;
                  $rendererLibrary = 'dompdf';
                  $rendererLibraryPath = './' . $rendererLibrary;
                  //require_once (realpath(dirname(dirname(dirname(__FILE__))))."/libraries/pdf.php");
                  //echo $rendererName.' and '.$rendererLibraryPath;
                  if (!PHPExcel_Settings::setPdfRenderer($rendererName,$rendererLibraryPath)) {
                      die('NOTICE: Please set the $rendererName and $rendererLibraryPath values' .EOL .'at the top of this script as appropriate for your directory structure');
                  }
                  header("HTTP/1.1 200 OK");
                  header("Pragma: public");
                  header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
                  header("Cache-Control: private", false);
                  header('Content-Type: application/pdf');
                  header('Content-Disposition: attachment;filename="rename.pdf"'); //tell browser what's the file name
                  header('Cache-Control: max-age=0'); //no cache
                  $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
                  $objWriter-&gt;setSheetIndex($i);
                  //$objWriter-&gt;save('test.pdf');
                  $objWriter-&gt;save('php://output');
                  break;
  
  
              }
              else{
                  continue;
              }
  
  
              }
          }
  
      //
  
  }   
  }
  catch(Exception $e)
  {
      //echo $e;
  }
  
  
  ?&gt;
  </code></pre>