lib/PHPPdf/Core/Facade.php
public function render($documentContent, $stylesheetContents = array(), $colorPaletteContent = null)
    {
        $colorPalette = new ColorPalette((array) $this->configurationLoader->createColorPalette());
        
        if($colorPaletteContent)
        {
            $colorPalette->merge($this->parseColorPalette($colorPaletteContent));
        }
        
        $this->document->setColorPalette($colorPalette);
        
        $complexAttributeFactory = $this->configurationLoader->createComplexAttributeFactory();
        
        $this->getDocument()->setComplexAttributeFactory($complexAttributeFactory);
        $fontDefinitions = $this->configurationLoader->createFontRegistry($this->engineType);
        $this->getDocument()->addFontDefinitions($fontDefinitions);
        $this->getDocumentParser()->setComplexAttributeFactory($complexAttributeFactory);
        $this->getDocumentParser()->setNodeFactory($this->configurationLoader->createNodeFactory());

        $stylesheetConstraint = $this->retrieveStylesheetConstraint($stylesheetContents);

        foreach($this->stringFilters as $filter)
        {
            $documentContent = $filter->filter($documentContent);
        }

        $pageCollection = $this->getDocumentParser()->parse($documentContent, $stylesheetConstraint);
        $this->updateStylesheetConstraintCacheIfNecessary($stylesheetConstraint);
        unset($stylesheetConstraint);

        return $this->doRender($pageCollection);
    }
public function render($documentContent, $stylesheetContents = array(), $colorPaletteContent = null)
    {
        $colorPalette = new ColorPalette((array) $this->configurationLoader->createColorPalette());
        
        if($colorPaletteContent)
        {
            $colorPalette->merge($this->parseColorPalette($colorPaletteContent));
        }
        
        $this->document->setColorPalette($colorPalette);
        
        $complexAttributeFactory = $this->configurationLoader->createComplexAttributeFactory();
        
        $this->getDocument()->setComplexAttributeFactory($complexAttributeFactory);
        $fontDefinitions = $this->configurationLoader->createFontRegistry($this->engineType);
        $this->getDocument()->addFontDefinitions($fontDefinitions);
        $this->getDocumentParser()->setComplexAttributeFactory($complexAttributeFactory);
        $this->getDocumentParser()->setNodeFactory($this->configurationLoader->createNodeFactory());

        $stylesheetConstraint = $this->retrieveStylesheetConstraint($stylesheetContents);

        foreach($this->stringFilters as $filter)
        {
            $documentContent = $filter->filter($documentContent);
        }

        $pageCollection = $this->getDocumentParser()->parse($documentContent, $stylesheetConstraint);
        $this->updateStylesheetConstraintCacheIfNecessary($stylesheetConstraint);
        unset($stylesheetConstraint);

        return $this->doRender($pageCollection);
    }
public function render ( $ documentContent , $ stylesheetContents = array ( ) , $ colorPaletteContent = null ) { $ colorPalette = new ColorPalette ( ( array ) $ this -> configurationLoader -> createColorPalette ( ) ) ; if ( $ colorPaletteContent ) { $ colorPalette -> merge ( $ this -> parseColorPalette ( $ colorPaletteContent ) ) ; } $ this -> document -> setColorPalette ( $ colorPalette ) ; $ complexAttributeFactory = $ this -> configurationLoader -> createComplexAttributeFactory ( ) ; $ this -> getDocument ( ) -> setComplexAttributeFactory ( $ complexAttributeFactory ) ; $ fontDefinitions = $ this -> configurationLoader -> createFontRegistry ( $ this -> engineType ) ; $ this -> getDocument ( ) -> addFontDefinitions ( $ fontDefinitions ) ; $ this -> getDocumentParser ( ) -> setComplexAttributeFactory ( $ complexAttributeFactory ) ; $ this -> getDocumentParser ( ) -> setNodeFactory ( $ this -> configurationLoader -> createNodeFactory ( ) ) ; $ stylesheetConstraint = $ this -> retrieveStylesheetConstraint ( $ stylesheetContents ) ; foreach ( $ this -> stringFilters as $ filter ) { $ documentContent = $ filter -> filter ( $ documentContent ) ; } $ pageCollection = $ this -> getDocumentParser ( ) -> parse ( $ documentContent , $ stylesheetConstraint ) ; $ this -> updateStylesheetConstraintCacheIfNecessary ( $ stylesheetConstraint ) ; unset ( $ stylesheetConstraint ) ; return $ this -> doRender ( $ pageCollection ) ; }
Convert text document to pdf document

@param string|DataSource $documentContent Source document content
@param DataSource[]|string[]|DataSource|string $stylesheetContents Stylesheet source(s)
@param string|DataSource $colorPaletteContent Palette of colors source

@return string Content of pdf document

@throws PHPPdf\Exception\Exception
Convert text document to pdf document