You are here

class PHPExcel_Writer_PDF_DomPDF in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/PDF/DomPDF.php \PHPExcel_Writer_PDF_DomPDF

PHPExcel_Writer_PDF_DomPDF

@category PHPExcel @package PHPExcel_Writer_PDF @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)

Hierarchy

Expanded class hierarchy of PHPExcel_Writer_PDF_DomPDF

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/PDF/DomPDF.php, line 44

View source
class PHPExcel_Writer_PDF_DomPDF extends PHPExcel_Writer_PDF_Core implements PHPExcel_Writer_IWriter {

  /**
   *  Create a new PHPExcel_Writer_PDF
   *
   *  @param   PHPExcel    $phpExcel    PHPExcel object
   */
  public function __construct(PHPExcel $phpExcel) {
    parent::__construct($phpExcel);
  }

  /**
   *  Save PHPExcel to file
   *
   *  @param   string     $pFilename   Name of the file to save as
   *  @throws  PHPExcel_Writer_Exception
   */
  public function save($pFilename = NULL) {
    $fileHandle = parent::prepareForSave($pFilename);

    //  Default PDF paper size
    $paperSize = 'LETTER';

    //    Letter    (8.5 in. by 11 in.)
    //  Check for paper size and page orientation
    if (is_null($this
      ->getSheetIndex())) {
      $orientation = $this->_phpExcel
        ->getSheet(0)
        ->getPageSetup()
        ->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
      $printPaperSize = $this->_phpExcel
        ->getSheet(0)
        ->getPageSetup()
        ->getPaperSize();
      $printMargins = $this->_phpExcel
        ->getSheet(0)
        ->getPageMargins();
    }
    else {
      $orientation = $this->_phpExcel
        ->getSheet($this
        ->getSheetIndex())
        ->getPageSetup()
        ->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
      $printPaperSize = $this->_phpExcel
        ->getSheet($this
        ->getSheetIndex())
        ->getPageSetup()
        ->getPaperSize();
      $printMargins = $this->_phpExcel
        ->getSheet($this
        ->getSheetIndex())
        ->getPageMargins();
    }
    $orientation = $orientation == 'L' ? 'landscape' : 'portrait';

    //  Override Page Orientation
    if (!is_null($this
      ->getOrientation())) {
      $orientation = $this
        ->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT ? PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT : $this
        ->getOrientation();
    }

    //  Override Paper Size
    if (!is_null($this
      ->getPaperSize())) {
      $printPaperSize = $this
        ->getPaperSize();
    }
    if (isset(self::$_paperSizes[$printPaperSize])) {
      $paperSize = self::$_paperSizes[$printPaperSize];
    }

    //  Create PDF
    $pdf = new DOMPDF();
    $pdf
      ->set_paper(strtolower($paperSize), $orientation);
    $pdf
      ->load_html($this
      ->generateHTMLHeader(FALSE) . $this
      ->generateSheetData() . $this
      ->generateHTMLFooter());
    $pdf
      ->render();

    //  Write to file
    fwrite($fileHandle, $pdf
      ->output());
    parent::restoreStateAfterSave($fileHandle);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PHPExcel_Writer_Abstract::$_diskCachingDirectory protected property * Disk caching directory * *
PHPExcel_Writer_Abstract::$_includeCharts protected property * Write charts that are defined in the workbook? * Identifies whether the Writer should write definitions for any charts that exist in the PHPExcel object; * *
PHPExcel_Writer_Abstract::$_preCalculateFormulas protected property * Pre-calculate formulas * Forces PHPExcel to recalculate all formulae in a workbook when saving, so that the pre-calculated values are * immediately available to MS Excel or other office spreadsheet viewer when opening the file * * 1
PHPExcel_Writer_Abstract::$_useDiskCaching protected property * Use disk caching where possible? * *
PHPExcel_Writer_Abstract::getDiskCachingDirectory public function * Get disk caching directory * *
PHPExcel_Writer_Abstract::getIncludeCharts public function * Write charts in workbook? * If this is true, then the Writer will write definitions for any charts that exist in the PHPExcel object. * If false (the default) it will ignore any charts defined in the PHPExcel object. * *
PHPExcel_Writer_Abstract::getPreCalculateFormulas public function Get Pre-Calculate Formulas flag * If this is true (the default), then the writer will recalculate all formulae in a workbook when saving, * so that the pre-calculated values are immediately available to MS Excel or other office…
PHPExcel_Writer_Abstract::getUseDiskCaching public function * Get use disk caching where possible? * *
PHPExcel_Writer_Abstract::setIncludeCharts public function * Set write charts in workbook * Set to true, to advise the Writer to include any charts that exist in the PHPExcel object. * Set to false (the default) to ignore charts. * *
PHPExcel_Writer_Abstract::setPreCalculateFormulas public function Set Pre-Calculate Formulas * Set to true (the default) to advise the Writer to calculate all formulae on save * Set to false to prevent precalculation of formulae on save.
PHPExcel_Writer_Abstract::setUseDiskCaching public function * Set use disk caching where possible? * *
PHPExcel_Writer_HTML::$_columnWidths private property * Array of column widths in points * *
PHPExcel_Writer_HTML::$_cssStyles private property * Array of CSS styles * *
PHPExcel_Writer_HTML::$_defaultFont private property * Default font * *
PHPExcel_Writer_HTML::$_embedImages private property * embed images, or link to images * *
PHPExcel_Writer_HTML::$_generateSheetNavigationBlock private property * Generate the Navigation block * *
PHPExcel_Writer_HTML::$_imagesRoot private property * Images root * *
PHPExcel_Writer_HTML::$_isBaseCell private property * Excel cells that are upper-left corner in a cell merge * *
PHPExcel_Writer_HTML::$_isPdf protected property * Is the current writer creating PDF? * *
PHPExcel_Writer_HTML::$_isSpannedCell private property * Excel cells that should not be written as HTML cells * *
PHPExcel_Writer_HTML::$_isSpannedRow private property * Excel rows that should not be written as HTML rows * *
PHPExcel_Writer_HTML::$_phpExcel protected property * PHPExcel object * *
PHPExcel_Writer_HTML::$_sheetIndex private property * Sheet index to write * *
PHPExcel_Writer_HTML::$_spansAreCalculated private property * Flag whether spans have been calculated * *
PHPExcel_Writer_HTML::$_useInlineCss private property * Use inline CSS? * *
PHPExcel_Writer_HTML::buildCSS public function * Build CSS styles * *
PHPExcel_Writer_HTML::formatColor public function * Add color to formatted string as inline style * *
PHPExcel_Writer_HTML::generateHTMLFooter public function * Generate HTML footer
PHPExcel_Writer_HTML::generateHTMLHeader public function * Generate HTML header * *
PHPExcel_Writer_HTML::generateNavigation public function * Generate sheet tabs * *
PHPExcel_Writer_HTML::generateSheetData public function * Generate sheet data * *
PHPExcel_Writer_HTML::generateStyles public function * Generate CSS styles * *
PHPExcel_Writer_HTML::getEmbedImages public function * Get embed images * *
PHPExcel_Writer_HTML::getGenerateSheetNavigationBlock public function * Get sheet index * *
PHPExcel_Writer_HTML::getImagesRoot public function * Get images root * *
PHPExcel_Writer_HTML::getSheetIndex public function * Get sheet index * *
PHPExcel_Writer_HTML::getUseInlineCss public function * Get use inline CSS? * *
PHPExcel_Writer_HTML::setEmbedImages public function * Set embed images * *
PHPExcel_Writer_HTML::setGenerateSheetNavigationBlock public function * Set sheet index * *
PHPExcel_Writer_HTML::setImagesRoot public function * Set images root * *
PHPExcel_Writer_HTML::setSheetIndex public function * Set sheet index * *
PHPExcel_Writer_HTML::setUseInlineCss public function * Set use inline CSS? * *
PHPExcel_Writer_HTML::writeAllSheets public function * Write all sheets (resets sheetIndex to NULL)
PHPExcel_Writer_HTML::_assembleCSS private function * Takes array where of CSS properties / values and converts to CSS string * *
PHPExcel_Writer_HTML::_calculateSpans private function * Calculate information about HTML colspan and rowspan which is not always the same as Excel's
PHPExcel_Writer_HTML::_createCSSStyle private function * Create CSS style * *
PHPExcel_Writer_HTML::_createCSSStyleAlignment private function * Create CSS style (PHPExcel_Style_Alignment) * *
PHPExcel_Writer_HTML::_createCSSStyleBorder private function * Create CSS style (PHPExcel_Style_Border) * *
PHPExcel_Writer_HTML::_createCSSStyleBorders private function * Create CSS style (PHPExcel_Style_Borders) * *
PHPExcel_Writer_HTML::_createCSSStyleFill private function * Create CSS style (PHPExcel_Style_Fill) * *
PHPExcel_Writer_HTML::_createCSSStyleFont private function * Create CSS style (PHPExcel_Style_Font) * *
PHPExcel_Writer_HTML::_extendRowsForChartsAndImages private function
PHPExcel_Writer_HTML::_generateRow private function * Generate row * *
PHPExcel_Writer_HTML::_generateTableFooter private function * Generate table footer * *
PHPExcel_Writer_HTML::_generateTableHeader private function * Generate table header * *
PHPExcel_Writer_HTML::_mapBorderStyle private function * Map border style * *
PHPExcel_Writer_HTML::_mapHAlign private function * Map HAlign * *
PHPExcel_Writer_HTML::_mapVAlign private function * Map VAlign * *
PHPExcel_Writer_HTML::_setMargins private function
PHPExcel_Writer_HTML::_writeChartInCell private function * Generate chart tag in cell * *
PHPExcel_Writer_HTML::_writeImageInCell private function * Generate image tag in cell * *
PHPExcel_Writer_PDF_Core::$_font protected property Font
PHPExcel_Writer_PDF_Core::$_orientation protected property Orientation (Over-ride)
PHPExcel_Writer_PDF_Core::$_paperSize protected property Paper size (Over-ride)
PHPExcel_Writer_PDF_Core::$_paperSizes protected static property Paper Sizes xRef List
PHPExcel_Writer_PDF_Core::$_saveArrayReturnType private property Temporary storage for Save Array Return type
PHPExcel_Writer_PDF_Core::$_tempDir protected property Temporary storage directory
PHPExcel_Writer_PDF_Core::getFont public function Get Font
PHPExcel_Writer_PDF_Core::getOrientation public function Get Orientation
PHPExcel_Writer_PDF_Core::getPaperSize public function Get Paper Size
PHPExcel_Writer_PDF_Core::getTempDir public function Get temporary storage directory
PHPExcel_Writer_PDF_Core::prepareForSave protected function Save PHPExcel to PDF file, pre-save
PHPExcel_Writer_PDF_Core::restoreStateAfterSave protected function Save PHPExcel to PDF file, post-save
PHPExcel_Writer_PDF_Core::setFont public function Set font. Examples: 'arialunicid0-chinese-simplified' 'arialunicid0-chinese-traditional' 'arialunicid0-korean' 'arialunicid0-japanese'
PHPExcel_Writer_PDF_Core::setOrientation public function Set Orientation
PHPExcel_Writer_PDF_Core::setPaperSize public function Set Paper Size
PHPExcel_Writer_PDF_Core::setTempDir public function Set temporary storage directory
PHPExcel_Writer_PDF_DomPDF::save public function Save PHPExcel to file Overrides PHPExcel_Writer_HTML::save
PHPExcel_Writer_PDF_DomPDF::__construct public function Create a new PHPExcel_Writer_PDF Overrides PHPExcel_Writer_PDF_Core::__construct