HeadlessChrome::savePdf()

@return
195457
public function savePdf($targetPath)
    {
        $this->callBrowser($this->createPdfCommand($targetPath));
        if (! file_exists($targetPath)) {
            throw CouldNotTakeBrowsershot::chromeOutputEmpty($targetPath);
        }
    }
711755
public function save()
    {
        $this->makeBackup();

        if (!is_dir(dirname($this->filename))) {
            mkdir(dirname($this->filename), 0700, true);
        }

        file_put_contents($this->filename, (string) $this);

        return $this;
    }
1082601
public function save()
    {
        global $wpdb;

        // Get the model's properties
        $props = $this->properties();

        // Flatten complex objects
        $props = $this->flatten_props($props);

        // Insert or update?
        if (is_null($props[static::get_primary_key()])) {
            $wpdb->insert($this->get_table(), $props);

            $this->{static::get_primary_key()} = $wpdb->insert_id;
        } else {
            $wpdb->update(static::get_table(), $props, array(static::get_primary_key() => $this->{static::get_primary_key()}));
        }

        return $this->id;
    }
574260
public function save()
    {
        if ($this->getPk() !== null && !empty($this->_state)) {
            return $this->_update();
        }
        return $this->_insert();
    }
1174162
public function save($pFilename = null) {

		// garbage collect
		$this->_phpExcel->garbageCollect();

		$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog();
		PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE);
		$saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
		PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);

		// initialize colors array
		$this->_colors          = array();

		// Initialise workbook writer
		$this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel,
																	 $this->_str_total, $this->_str_unique, $this->_str_table,
																	 $this->_colors, $this->_parser);

		// Initialise worksheet writers
		$countSheets = $this->_phpExcel->getSheetCount();
		for ($i = 0; $i < $countSheets; ++$i) {
			$this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->_str_total, $this->_str_unique,
																			   $this->_str_table, $this->_colors,
																			   $this->_parser,
																			   $this->_preCalculateFormulas,
																			   $this->_phpExcel->getSheet($i));
		}

		// build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook.
		$this->_buildWorksheetEschers();
		$this->_buildWorkbookEscher();

		// add 15 identical cell style Xfs
		// for now, we use the first cellXf instead of cellStyleXf
		$cellXfCollection = $this->_phpExcel->getCellXfCollection();
		for ($i = 0; $i < 15; ++$i) {
			$this->_writerWorkbook->addXfWriter($cellXfCollection[0], true);
		}

		// add all the cell Xfs
		foreach ($this->_phpExcel->getCellXfCollection() as $style) {
			$this->_writerWorkbook->addXfWriter($style, false);
		}

		// add fonts from rich text eleemnts
		for ($i = 0; $i < $countSheets; ++$i) {
			foreach ($this->_writerWorksheets[$i]->_phpSheet->getCellCollection() as $cellID) {
				$cell = $this->_writerWorksheets[$i]->_phpSheet->getCell($cellID);
				$cVal = $cell->getValue();
				if ($cVal instanceof PHPExcel_RichText) {
					$elements = $cVal->getRichTextElements();
					foreach ($elements as $element) {
						if ($element instanceof PHPExcel_RichText_Run) {
							$font = $element->getFont();
							$this->_writerWorksheets[$i]->_fntHashIndex[$font->getHashCode()] = $this->_writerWorkbook->_addFont($font);
						}
					}
				}
			}
		}

		// initialize OLE file
		$workbookStreamName = 'Workbook';
		$OLE = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs($workbookStreamName));

		// Write the worksheet streams before the global workbook stream,
		// because the byte sizes of these are needed in the global workbook stream
		$worksheetSizes = array();
		for ($i = 0; $i < $countSheets; ++$i) {
			$this->_writerWorksheets[$i]->close();
			$worksheetSizes[] = $this->_writerWorksheets[$i]->_datasize;
		}

		// add binary data for global workbook stream
		$OLE->append($this->_writerWorkbook->writeWorkbook($worksheetSizes));

		// add binary data for sheet streams
		for ($i = 0; $i < $countSheets; ++$i) {
			$OLE->append($this->_writerWorksheets[$i]->getData());
		}

		$this->_documentSummaryInformation = $this->_writeDocumentSummaryInformation();
		// initialize OLE Document Summary Information
		if(isset($this->_documentSummaryInformation) && !empty($this->_documentSummaryInformation)){
			$OLE_DocumentSummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'DocumentSummaryInformation'));
			$OLE_DocumentSummaryInformation->append($this->_documentSummaryInformation);
		}

		$this->_summaryInformation = $this->_writeSummaryInformation();
		// initialize OLE Summary Information
		if(isset($this->_summaryInformation) && !empty($this->_summaryInformation)){
		  $OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation'));
		  $OLE_SummaryInformation->append($this->_summaryInformation);
		}

		// define OLE Parts
		$arrRootData = array($OLE);
		// initialize OLE Properties file
		if(isset($OLE_SummaryInformation)){
			$arrRootData[] = $OLE_SummaryInformation;
		}
		// initialize OLE Extended Properties file
		if(isset($OLE_DocumentSummaryInformation)){
			$arrRootData[] = $OLE_DocumentSummaryInformation;
		}

		$root = new PHPExcel_Shared_OLE_PPS_Root(time(), time(), $arrRootData);
		// save the OLE file
		$res = $root->save($pFilename);

		PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType);
		PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog);
	}
1208472
public function generate()
	{
		$returnVar = $this->executeCommand($output);

		if ($returnVar == 0)
		{
			$this->contents = $this->getPDFContents();
		}
		else
		{
			throw new PDFException($output);
		}

		$this->removeTmpFiles();

		return $this;
	}
906972
public function save()
    {
        if(file_exists($this->_config_file_path)){

            chmod($this->_config_file_path, 0644);

            $content = "<?php\nclass AnSiteConfig{\n";

            foreach($this->_attributes as $key=>$value) {
              if(!is_array($value)){
                $content .= "    var \$$key = '$value';\n";
              }
            }

            $content .= "}\n";

            try {
              file_put_contents($this->_config_file_path, $content);
            } catch (Exception $e) {
                throw new \RuntimeException($e->getMessage());
            }

            chmod($this->_config_file_path, 0444);

            $this->_clearCache();
        }

        return $this;
    }
1051264
public function saveLean() {
		$fh = fopen($this->getDirname().'/'.$this->getLeanName(),'w');
		fwrite($fh, $this->leanCSS->render());	
	}
330229
public static boolean generatePDF() {
        String generatePDF = getProgramProperty(GENERATE_PDF);
        if (generatePDF == null) {
            return false;
        }
        if ("".equals(generatePDF)) {
            return true;
        }
        return "true".equalsIgnoreCase(generatePDF);
    }
58766
public function generate()
    {
        $output = $this->outputDir."/".preg_replace("/\.pdf$/", "", basename($this->file)).".html";
        $options = $this->generateOptions();

        if (PHP_OS === 'WINNT') {
            $command = '"'.$this->bin().'" '.$options.' "'.$this->file.'" "'.$output.'"';
        }
        else {
            $command = $this->bin()." ".$options." '".$this->file."' '".$output."'";
        }

        exec($command);

        return $this;
    }
1156505
public function save(string $filename, bool $force_download = false)
    {
        $basename  = pathinfo($filename, PATHINFO_BASENAME);
        $extension = pathinfo($filename, PATHINFO_EXTENSION);

        $factory = null;
        foreach($this->writers as $slug => $writer) {

            if ($extension == $slug && $slug == 'pdf') {
                IOFactory::registerWriter('CustomPDF', PDFWriter::class);
                $factory = IOFactory::createWriter($this->getSpreadsheet(), 'CustomPDF');

            } elseif ($extension == $slug && in_array($slug, ['html', 'htm']) == true) {
                IOFactory::registerWriter('CustomHtml', HtmlWriter::class);
                $factory = IOFactory::createWriter($this->getSpreadsheet(), 'CustomHtml');

            } elseif ($extension == $slug) {
                $factory = IOFactory::createWriter($this->getSpreadsheet(), $writer);
            }
        }

        if ($factory == null) {
            throw new \InvalidArgumentException(
                "Unsupported file type for writing. Use " . implode(',', $this->writers));
        }

        if ($force_download == true) {
            $this->httpHeaders($basename, $extension);
            $factory->save('php://output');
        } else {
            $factory->save($filename);
        }
    }
784830
public function save()
    {
        $keys = array_keys($this->langstrings);
        sort($keys);

        $maxlen       = 0;
        $langPrefixes = array();
        foreach ($keys as $key) {
            $tokens = explode('.', $key);
            if (preg_match('/tl_layout\.[a-z]+\.css\./', $key)) {
                $tokens = array($tokens[0], $tokens[1] . '.' . $tokens[2], $tokens[3]);
            }
            $langPrefix = '$GLOBALS[\'TL_LANG\']';
            foreach ($tokens as $token) {
                $langPrefix .= '[\'' . $token . '\']';
            }

            $langPrefixes[$key] = $langPrefix;

            if (strlen($langPrefix) > $maxlen) {
                $maxlen = strlen($langPrefix);
            }
        }

        $buffer = $this->getHead() . PHP_EOL . PHP_EOL;
        foreach ($keys as $key) {
            $prefix  = $langPrefixes[$key];
            $buffer .= sprintf(
                '%s = %s;' . PHP_EOL,
                $prefix . str_repeat(' ', ($maxlen - strlen($prefix))),
                var_export($this->getValue($key), true)
            );
        }
        $buffer  .= PHP_EOL;
        $resource = fopen($this->filename, 'wb');
        fputs($resource, $buffer);

        fclose($resource);
    }
831860
public function generate() {
		$tmp_pdf_path = create_tmp_file();
		$success = $this->generateWithPrince( null, null, $this->generateHtml(), $tmp_pdf_path );
		if ( true !== $success ) {
			throw new \Exception( 'Failed to create PDF file' );
		}
		$output_path = $this->timestampedFileName( 'jpg' );
		$this->convert( $tmp_pdf_path, $output_path );
		delete_transient( 'dirsize_cache' ); /** @see get_dirsize() */
		return $output_path;
	}
1137724
public function formatted()
    {
        $doc = dom_import_simplexml($this->root)->ownerDocument;
        $doc->preserveWhiteSpace = false;
        $doc->formatOutput = true;
        $doc->encoding = 'UTF-8';

        return $doc->saveXML();
    }
1085734
public function template2Pdf()
    {
        /**transport use to get the variables $order object, $invoice object and the template model object*/
        $parts = $this->transport();

        /** instantiate the mPDF class and add the processed html to get the pdf*/
        $applySettings = $this->eaPDFSettings($parts);

        $fileParts = [
            'filestream' => $applySettings,
            'filename' => filter_var($parts['filename'], FILTER_SANITIZE_URL)
        ];

        return $fileParts;
    }
136060
function PhantonmJsPdf(){
	this.session = null;

	this.createToken = function () {
	    return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
	        var r = Math.random()*16|0, v = c === 'x' ? r : (r&0x3|0x8);
	        return v.toString(16);
	    });
	};
}
103270
public function save()
    {
        if ($this->afterLine === null) {
            throw ClassHelper::create('AutoGitIgnoreSaveException', 'No file loaded.');
        }

        $output = array();
        if ($this->afterLine === 0) {
            $output[] = $this->startMarker;
            foreach ($this->lines as $l) {
                $output[] = $l;
            }
            $output[] = $this->endMarker;
        }
        $i = 0;
        foreach ($this->fileContent as $line) {
            $i++;

            $output[] = $line;
            if ($i == $this->afterLine) {
                $output[] = $this->startMarker;
                foreach ($this->lines as $l) {
                    $output[] = $l;
                }
                $output[] = $this->endMarker;
            }
        }

        if (!file_put_contents($this->getFile(), implode(PHP_EOL, $output))) {
            throw ClassHelper::create('AutoGitIgnoreSaveException', 'Saving to ' . $this->getFile() . ' failed.');
        }

        return $this;
    }