title: phpexcel save pdf using tcpdf having pdf width issue
body: <p>i am using php excel tcpdf render to save file as pdf. pdf can save successfully but pdf only saving as A4 size and it cuts my columns. i have many columns so i need all columns on pdf. pdf width should be auto so it can generate pdf as per number of columns given. please have a look below is my code i tried. also i included image i taken from pdf generated. you can see my pdf width is fix so my content is cut. any suggestion </p>
  
  <pre><code>    if (PHP_SAPI == 'cli')
          die('This example should only be run from a Web Browser');
  
  
      $rendererName = PHPExcel_Settings::PDF_RENDERER_TCPDF;
  
      $rendererLibrary = 'tcpdf';
  
      $rendererLibraryPath = '' . $rendererLibrary;
  
      //echo $rendererLibraryPath;
      // Create new PHPExcel object
      $objPHPExcel = new PHPExcel();
  
  
      // Set document properties
      $objPHPExcel-&gt;getProperties()-&gt;setCreator("Maarten Balliauw")
                                   -&gt;setLastModifiedBy("Maarten Balliauw")
                                   -&gt;setTitle("PDF Test Document")
                                   -&gt;setSubject("PDF Test Document")
                                   -&gt;setDescription("Test document for PDF, generated using PHP classes.")
                                   -&gt;setKeywords("pdf php")
                                   -&gt;setCategory("Test result file");
  
      // Rename worksheet
      $objPHPExcel-&gt;getActiveSheet()-&gt;setTitle('Simple');
      $objPHPExcel-&gt;getActiveSheet()-&gt;setShowGridLines(false);
  
       //If used external excel file 
      $inputFile="xlsx_file/subcategory.xlsx";
      $inputFileType = PHPExcel_IOFactory::identify($inputFile);
      $objReader = PHPExcel_IOFactory::createReader($inputFileType);
      $objPHPExcel = $objReader-&gt;load($inputFile);
  
      foreach ($objPHPExcel-&gt;getWorksheetIterator() as $worksheet) 
      {
  
  
  
          $worksheet-&gt;setShowGridLines(true);
          $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);
  
  
      // Set active sheet index to the first sheet, so Excel opens this as the first sheet
      $objPHPExcel-&gt;setActiveSheetIndex(0);
  
  
  
      if (!PHPExcel_Settings::setPdfRenderer(
              $rendererName,
              $rendererLibraryPath
          )) {
          die(
              'NOTICE: Please set the $rendererName and $rendererLibraryPath values' .
              '&lt;br /&gt;' .
              'at the top of this script as appropriate for your directory structure'
          );
      }
  
      $rand = rand(1234, 9898);
      $presentDate = date('YmdHis');
      $fileName = "report_" . $rand . "_" . $presentDate . ".pdf";
  
      // Redirect output to a client’s web browser (PDF)
      header('Content-Type: application/pdf');
      header('Content-Disposition: attachment;filename="'.$fileName.'"');
      header('Cache-Control: max-age=0');
  
      $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
      $objWriter-&gt;save('php://output');
      exit;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/rmcAo.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rmcAo.jpg" alt="enter image description here"></a></p>