Método que genera el footer del PDF
@author Esteban De La Fuente Rubio, DeLaF (esteban[at]delaf.cl)
@version 2015-03-20
164994
public function Footer()
    {
        if (is_array($this->footer) and (!empty($this->footer['left']) or !empty($this->footer['right']))) {
            $style = ['width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => [50, 50, 50]];
            $this->Line(0, $this->getY()-1, 290, $this->getY()-2, $style);
            $this->SetFont('', 'B', 6);
            if (empty($this->papelContinuo)) {
                if (!empty($this->footer['left']))
                    $this->Texto($this->footer['left']);
                if (!empty($this->footer['right']))
                    $this->Texto($this->footer['right'], null, null, 'R');
            } else {
                if (!empty($this->footer['left']))
                    $this->Texto($this->footer['left'], null, null, 'C');
                if (!empty($this->footer['right'])) {
                    $this->Ln();
                    $this->Texto($this->footer['right'], null, null, 'C');
                }
            }
        }
    }
372115
public function generatepage_pdf(){
		foreach($this->rules as &$c){
			$this->positions[$c->position]=$c->output;
			}
		header("Content-type: application/pdf");
		echo $this->positions['content'];
		}
1249135
public function actionPdf()
    {
        $this->getSearchCriteria();
        $this->layout = static::BLANK_LAYOUT;
        $this->dataProvider->pagination = false;
        $content = $this->render('pdf', [
            'dataProvider' => $this->dataProvider,
        ]);
        if (isset($_GET['test'])) {
            return $content;
        } else {
            $mpdf = new \mPDF();
            $mpdf->WriteHTML($content);

            Yii::$app->response->getHeaders()->set('Content-Type', 'application/pdf');
            Yii::$app->response->getHeaders()->set('Content-Disposition', 'attachment; filename="' . $this->getCompatibilityId() . '.pdf"');
            return $mpdf->Output($this->getCompatibilityId() . '.pdf', 'S');
        }
    }
494121
private function writeEndereco (
        $t, $l, $w, $titulo, $nomeDestinatario, $logradouro, $numero1, $complemento, $bairro,
        $cidade, $uf, $cep = null, $destinatario = false
    ) {
        //$this->pdf->SetTextColor(51,51,51);
        if ($destinatario === true) {
            $addressPadding = 5;

            $t = $t-2;
            $this->pdf->SetDrawColor(0,0,0);
            $this->pdf->Line(0, $t, 106.36, $t);

            // Titulo do bloco: destinatario
            $this->pdf->setFillColor(0,0,0);
            $this->pdf->SetDrawColor(0,0,0);
            $this->pdf->Rect(0, $t, 36, 5, 'F');

            $this->pdf->SetFont('', 'B');
            $this->pdf->SetFontSize(11);
            $this->pdf->SetTextColor(255,255,255);
            $this->pdf->SetXY($l + 3, $t);
            $this->t($w, $titulo, 2, '');

            $this->pdf->SetTextColor(0,0,0);

            $this->pdf->Image(realpath(dirname(__FILE__)) . '/logo-correios.png', 84, $t+1, 20, 4);

            // Nome da pessoa
            $this->pdf->SetFont('', '', 11);
            $this->setFillColor(190, 190, 190);
            $this->pdf->SetX($l + $addressPadding);
            $this->multiLines($w, $nomeDestinatario, 'L');

        } else {
            $addressPadding = 2;
            $t = $t -1;
            $this->pdf->SetDrawColor(0,0,0);
            $this->pdf->Line(0, $t, 106.36, $t);

            $t++;

            // Titulo do bloco: destinatario ou remetente
            $this->pdf->SetFont('', 'B');
            $this->setFillColor(60, 60, 60);
            $this->pdf->SetFontSize(10);
            $this->pdf->SetXY(2, $t);
            $this->t($w, $titulo, 2, '');

            // Nome da pessoa
            $this->pdf->SetFont('', '', 10);
            $this->setFillColor(190, 190, 190);
            $this->pdf->SetXY(22, $t);
            $this->multiLines($w, trim($nomeDestinatario), 'L');
        }

        $w = $w - $addressPadding;
        $l = $l + $addressPadding;

        //Primeria parte do endereco
        $address1 = $logradouro;
        $numero = $numero1;
        if (!$numero || strtolower($numero) == 'sn') {
            $address1 .= ', s/ nº';
        } else {
            $address1 .= ', ' . $numero;
        }
        if ($complemento) {
            $complemento = $complemento . ' ';
        }
        $this->setFillColor(100, 190, 190);
        $this->pdf->SetX($l);
        $this->multiLines($w, $address1, 'L');

        //Segunda parte do endereco
        $this->pdf->SetX($l);

        $this->setFillColor(100, 130, 190);
        $this->multiLines($w, $complemento . $bairro, 'L');

        $this->setFillColor(100, 30, 210);
        $this->pdf->SetX($l);
        $this->pdf->SetFont('', 'B');
        $this->t($l, ($cep ? $cep . '  ' : ''), 0, 'L');

        $this->pdf->SetFont('');
        $this->pdf->SetX($l + 20);
        $this->t(15, ucfirst(trim($cidade)) . '/' . strtoupper(trim($uf)), 2, 'L');

        return $this->pdf->GetY();
    }
628415
private function _readFooter()
	{
		$length = self::_GetInt2d($this->_data, $this->_pos + 2);
		$recordData = substr($this->_data, $this->_pos + 4, $length);

		// move stream pointer to next record
		$this->_pos += 4 + $length;

		if (!$this->_readDataOnly) {
			// offset: 0; size: var
			// realized that $recordData can be empty even when record exists
			if ($recordData) {
				if ($this->_version == self::XLS_BIFF8) {
					$string = self::_readUnicodeStringLong($recordData);
				} else {
					$string = $this->_readByteStringShort($recordData);
				}
				$this->_phpSheet->getHeaderFooter()->setOddFooter($string['value']);
				$this->_phpSheet->getHeaderFooter()->setEvenFooter($string['value']);
			}
		}
	}
928883
private function respaldarDocumentosEmitidos()
    {
        // obtener DTE emitidos en el Portal MIPYME del SII
        $this->log('Descargando documentos emitidos');
        $emitidos = $this->LibreDTE->post('/utilidades/sii/mipyme_dte_emitidos/'.$this->args['contribuyente'], [
            'auth'=>[
                'rut' => $this->args['usuario'],
                'clave' => $this->args['clave'],
            ],
        ]);
        if ($emitidos['status']['code']!=200) {
            $this->log(' [error] Al obtener DTE emitidos en Portal MIPYME del SII: '.$emitidos['body']);
            return;
        }
        file_put_contents($this->args['salida'].'/emitidos_'.$this->args['contribuyente'].'.json', json_encode($emitidos['body'], JSON_PRETTY_PRINT));
        // descargar PDF y XML de los documentos
        $n_docs = count($emitidos['body']);
        $i = 0;
        foreach ($emitidos['body'] as $doc) {
            $i++;
            $this->log('Descargando PDF y XML '.$this->num($i).'/'.$this->num($n_docs).' '.$doc['dte'].' #'.$doc['folio']);
            // descargar PDF
            $pdf = $this->LibreDTE->post('/utilidades/sii/mipyme_dte_emitido_pdf/'.$this->args['contribuyente'].'/'.$doc['codigo'], [
                'auth'=>[
                    'rut' => $this->args['usuario'],
                    'clave' => $this->args['clave'],
                ],
            ]);
            if ($pdf['status']['code']!=200) {
                $this->log(' [error] Al obtener el PDF '.$doc['codigo'].': '.$pdf['body']);
            } else {
                file_put_contents($this->args['salida'].'/emitidos/dte_'.$this->args['contribuyente'].'_T'.$this->getCodigoDTE($doc['dte']).'F'.$doc['folio'].'.pdf', $pdf['body']);
            }
            // descargar XML
            $xml = $this->LibreDTE->post('/utilidades/sii/mipyme_dte_emitido_xml/'.$this->args['contribuyente'].'/'.$this->getCodigoDTE($doc['dte']).'/'.$doc['folio'], [
                'auth'=>[
                    'rut' => $this->args['usuario'],
                    'clave' => $this->args['clave'],
                ],
            ]);
            if ($xml['status']['code']!=200) {
                $this->log(' [error] Al obtener el XML '.$doc['codigo'].': '.$xml['body']);
            } else {
                file_put_contents($this->args['salida'].'/emitidos/dte_'.$this->args['contribuyente'].'_T'.$this->getCodigoDTE($doc['dte']).'F'.$doc['folio'].'.xml', $xml['body']);
            }
        }
    }
655330
public function bootstrap()
    {
        if (! defined('ABSPATH')) {
            define('ABSPATH', "{$this->path}/");
        }

        $_SERVER['DOCUMENT_ROOT']   = $this->path;
        $_SERVER['HTTP_HOST']       = '';
        $_SERVER['REQUEST_METHOD']  = 'GET';
        $_SERVER['REQUEST_URI']     = '/';
        $_SERVER['SERVER_NAME']     = '';
        $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';

        if (! file_exists("{$this->path}/index.php")) {
            throw new RuntimeException(sprintf('[W200] WordPress PHP driver cannot find WordPress at %s.', $this->path));
        }

        // "Cry 'Havoc!' and let slip the dogs of war".
        require_once "{$this->path}/wp-blog-header.php";

        if (! function_exists('activate_plugin')) {
            require_once "{$this->path}/wp-admin/includes/plugin.php";
            require_once "{$this->path}/wp-admin/includes/plugin-install.php";
        }

        $this->wpdb            = $GLOBALS['wpdb'];
        $this->is_bootstrapped = true;
    }
27355
protected function renderFooter()
    {
        if (!$this->footer &&
            $this->closeButtonPosition != self::CLOSE_BUTTON_POSITION_BEFORE_FOOTER &&
            $this->closeButtonPosition != self::CLOSE_BUTTON_POSITION_AFTER_FOOTER) {
            return '';
        }

        $html = [];
        Html::addCssClass($this->footerOptions, ['footer' => 'modal-footer']);
        $html[] = Html::beginTag('div', $this->footerOptions);

        if ($this->closeButtonPosition === self::CLOSE_BUTTON_POSITION_BEFORE_FOOTER) {
            $html[] = $this->renderCloseButton();
        }

        $html[] = $this->footer;

        if ($this->closeButtonPosition === self::CLOSE_BUTTON_POSITION_AFTER_FOOTER) {
            $html[] = $this->renderCloseButton();
        }

        $html[] = Html::endTag('div');

        return implode("\n", $html);
    }
249909
public function getTextFormat()
    {
        $args = func_get_args();
        if (count($args) == 2) {
            $pageNumber = $args[0];
            $fragmentNumber = $args[1];
        }
        if (count($args) == 3) {
            $pageNumber = $args[0];
            $fragmentNumber = $args[1];
            $segamentNumber = $args[2];
        }
        $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages/' . $pageNumber .
            '/fragments/' . $fragmentNumber;
        if (isset($segamentNumber)) {
            $strURI .= '/segments/' . '/textformat';
        } else {
            $strURI .= '/textformat';
        }
        $signedURI = Utils::sign($strURI);

        $responseStream = Utils::processCommand($signedURI, 'GET', '', '');

        $json = json_decode($responseStream);

        return $json->TextFormat;
    }
260834
public function pdf()
    {
        if ('snappy' == config('datatables-buttons.pdf_generator', 'snappy')) {
            return $this->snappyPdf();
        }

        return $this->buildExcelFile()->download($this->getFilename() . '.pdf', $this->pdfWriter);
    }
487593
public function index() {

		$this->Printer->recursive = 0;
		$impresoras = $this->Paginator->paginate();

		$impresorasModificadas = array();
		foreach( $impresoras as $imp ) {
			// por cada impresora, le agrego la cantidad de productos relacionados que tiene
			$printerId = $imp['Printer']['id'];
			$cant = $this->Printer->cantidadDeProductosEnImpresora($printerId);
			$imp['Printer']['cantidad_productos'] = $cant;
			$impresorasModificadas[] = $imp;
		}

		$this->set('printers', $impresorasModificadas);
	}
351595
protected function compileTableFooter()
    {
        $footer = [];
        foreach ($this->collection->all() as $row) {
            if (is_array($row->footer)) {
                $footerAttr = $this->html->attributes(array_only($row->footer,
                    ['class', 'id', 'title', 'width', 'style', 'data-class', 'data-hide']));
                $title = isset($row->footer['title']) ? $row->footer['title'] : '';
                $footer[] = '<th ' . $footerAttr . '>' . $title . '</th>';
            } else {
                $footer[] = '<th>' . $row->footer . '</th>';
            }
        }

        return $footer;
    }
6603
public function Footer()
    {
        $this->SetY(-15);
        $this->billetSetFont('footer');
        $this->Cell(88.5, 5, $this->PageNo() . " / $this->AliasNbPages");
        $this->Cell(88.5, 5, date('Y-m-d H:i:s O'), 0, 0, 'R');
    }
1167125
public function renderPagebrowser()
    {
        /** @var \TYPO3\CMS\Fluid\View\StandaloneView $view */
        $view = GeneralUtility::makeInstance(\TYPO3\CMS\Fluid\View\StandaloneView::class);
        $view->setTemplateRootPaths($this->conf['view']['templateRootPaths']);
        $view->setTemplate('Widget/Pagination');
        $pagination = [];

        $numberOfResults = $this->numberOfResults;
        $resultsPerPage = $this->conf['resultsPerPage'];
        $maxPages = $this->conf['maxPagesInPagebrowser'];

        // get total number of items to show
        // show pagebrowser only if there are more entries that are shown on one page
        if ($numberOfResults > $resultsPerPage) {
            $this->limit = $resultsPerPage;
        } else {
            return;
        }

        // set db limit
        $start = ($this->piVars['page'] * $resultsPerPage) - $resultsPerPage;
        $this->dbLimit = $start . ',' . $resultsPerPage;
        $end = ($start + $resultsPerPage > $numberOfResults) ? $numberOfResults : ($start + $resultsPerPage);

        // number of pages
        $pagesTotal = ceil($numberOfResults / $resultsPerPage);

        // calculate start and end page
        $startPage = $this->piVars['page'] - ceil(($maxPages / 2));
        $endPage = $startPage + $maxPages - 1;
        if ($startPage < 1) {
            $startPage = 1;
            $endPage = $startPage + $maxPages - 1;
        }
        if ($startPage > $pagesTotal) {
            $startPage = $pagesTotal - $maxPages + 1;
            $endPage = $pagesTotal;
        }
        if ($endPage > $pagesTotal) {
            $startPage = $pagesTotal - $maxPages + 1;
            $endPage = $pagesTotal;
        }

        // create pages list, previous, current and next for pagination widget
        $pages = [];
        for ($i = 1; $i <= $pagesTotal; $i++) {
            if ($i >= $startPage && $i <= $endPage) {
                $pages[] = $i;
            }
        }
        $pagination['pages'] = $pages;

        if ($this->piVars['page'] > 1) {
            $pagination['previous'] = $this->piVars['page'] - 1;
        }

        if ($this->piVars['page'] < $pagesTotal) {
            $pagination['next'] = $this->piVars['page'] + 1;
        }

        $pagination['currentPage'] = $this->piVars['page'];
        $view->assign('pagination', $pagination);

        // render pagebrowser content and pass it together with some variables to fluid template
        $markerArray = array(
            'current' => $this->piVars['page'],
            'pages_total' => $pagesTotal,
            'pages_list' => $view->render(),
            'start' => $start + 1,
            'end' => $end,
            'total' => $numberOfResults,
            'results' => $this->pi_getLL('results'),
            'until' => $this->pi_getLL('until'),
            'of' => $this->pi_getLL('of'),
        );

        // hook for additional markers in pagebrowser
        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['pagebrowseAdditionalMarker'])) {
            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['pagebrowseAdditionalMarker'] as $_classRef) {
                $_procObj = &GeneralUtility::makeInstance($_classRef);
                $_procObj->pagebrowseAdditionalMarker(
                    $markerArray,
                    $this
                );
            }
        }

        $this->fluidTemplateVariables['pagebrowser'] = $markerArray;
    }
949842
public function generate() {
		$output_path = $this->timestampedFileName( 'pdf' );
		$this->generateWithDocraptor( $this->pdfProfile, $this->generateHtml(), $output_path );
		delete_transient( 'dirsize_cache' ); /** @see get_dirsize() */
		return $output_path;
	}
1227413
public function generatePDF()
    {
        if (!$this->owner->data()->config()->get('pdf_export')) {
            return false;
        }

        $binaryPath = $this->owner->data()->config()->get('wkhtmltopdf_binary');
        if ($binaryPath) {
            Deprecation::notice('3.0', 'wkhtmltopdf_binary config is deprecated. '.
                'Use WKHTMLTOPDF_BINARY env var instead.');
        }
        if (!$binaryPath || !is_executable($binaryPath)) {
            if (Environment::getEnv('WKHTMLTOPDF_BINARY')
                && is_executable(Environment::getEnv('WKHTMLTOPDF_BINARY'))
            ) {
                $binaryPath = Environment::getEnv('WKHTMLTOPDF_BINARY');
            }
        }

        if (!$binaryPath) {
            user_error(
                'Neither WKHTMLTOPDF_BINARY nor ' . get_class($this->owner->data()) . '.wkhtmltopdf_binary are defined',
                E_USER_ERROR
            );
        }

        if (Versioned::get_reading_mode() == 'Stage.Stage') {
            user_error('Generating PDFs on draft is not supported', E_USER_ERROR);
        }

        set_time_limit(60);

        // prepare the paths
        $pdfFile = $this->owner->data()->getPdfFilename();
        $bodyFile = str_replace('.pdf', '_pdf.html', $pdfFile);
        $footerFile = str_replace('.pdf', '_pdffooter.html', $pdfFile);

        // make sure the work directory exists
        if (!file_exists(dirname($pdfFile))) {
            Filesystem::makeFolder(dirname($pdfFile));
        }

        //decide the domain to use in generation
        $pdfBaseUrl = $this->owner->getPDFBaseURL();

        // Force http protocol on CWP - fetching from localhost without using the proxy, SSL terminates on gateway.
        if (Environment::getEnv('CWP_ENVIRONMENT')) {
            Config::modify()->set(Director::class, 'alternate_protocol', 'http');
            //only set alternate protocol if CWP_SECURE_DOMAIN is defined OR pdf_base_url is
            if ($pdfBaseUrl) {
                Config::modify()->set(Director::class, 'alternate_base_url', 'http://' . $pdfBaseUrl);
            }
        }

        $bodyViewer = $this->owner->getViewer('pdf');

        // write the output of this page to HTML, ready for conversion to PDF
        file_put_contents($bodyFile, $bodyViewer->process($this->owner));

        // get the viewer for the current template with _pdffooter
        $footerViewer = $this->owner->getViewer('pdffooter');

        // write the output of the footer template to HTML, ready for conversion to PDF
        file_put_contents($footerFile, $footerViewer->process($this->owner));

        //decide what the proxy should look like
        $proxy = $this->owner->getPDFProxy($pdfBaseUrl);

        // finally, generate the PDF
        $command = $binaryPath . $proxy . ' --outline -B 40pt -L 20pt -R 20pt -T 20pt --encoding utf-8 '
            . '--orientation Portrait --disable-javascript --quiet --print-media-type ';
        $retVal = 0;
        $output = [];
        exec(
            $command . " --footer-html \"$footerFile\" \"$bodyFile\" \"$pdfFile\" &> /dev/stdout",
            $output,
            $retVal
        );

        // remove temporary file
        unlink($bodyFile);
        unlink($footerFile);

        // output any errors
        if ($retVal != 0) {
            user_error('wkhtmltopdf failed: ' . implode("\n", $output), E_USER_ERROR);
        }

        // serve the generated file
        return HTTPRequest::send_file(file_get_contents($pdfFile), basename($pdfFile), 'application/pdf');
    }
1313653
public function hPrintFooter() {
	    $wt_tree = Globals::getTree();
	    $html = '';
	    if($this->getSetting('MAJ_DISPLAY_CNIL', 0) == 1){
	        $html .= '<br/>';
	        $html .= '<div class="center">';
	        $cnil_ref = $this->getSetting('MAJ_CNIL_REFERENCE', '');
	        if($cnil_ref != ''){
	            $html .= I18N::translate('This site has been notified to the French National Commission for Data protection (CNIL) and registered under number %s. ', $cnil_ref);
	        }
	        $html .= I18N::translate('In accordance with the French Data protection Act (<em>Loi Informatique et Libertés</em>) of January 6th, 1978, you have the right to access, modify, rectify and delete personal information that pertains to you. To exercice this right, please contact %s, and provide your name, address and a proof of your identity.',
	            Theme::theme()->contactLink(User::find($wt_tree->getPreference('WEBMASTER_USER_ID'))));
	        $html .= '</div>';
	    }
	    
	    if($this->getSetting('MAJ_ADD_HTML_FOOTER', 0) == 1){
	        if(Auth::accessLevel($wt_tree) >= $this->getSetting('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE)  && !Filter::getBool('nofooter')){
	            $html .= $this->getSetting('MAJ_HTML_FOOTER', '');
	        }
	    }
	    return $html;
	}