mikehaertl\wkhtmlto\Image::setPage PHP Method

setPage() public method

Add a page object to the output
public setPage ( string $page ) : static
$page string either a URL, a HTML string or a filename
return static the Image instance for method chaining
    public function setPage($page)
    {
        $this->_page = preg_match(self::REGEX_HTML, $page) ? new File($page, '.html') : $page;
        return $this;
    }

Usage Example

Example #1
0
 /**
  * Create an object
  *
  * @param  ContainerInterface $container
  * @param  string $requestedName
  * @param  null|array $options
  * @return object
  * @throws ServiceNotFoundException if unable to resolve the service.
  * @throws ServiceNotCreatedException if an exception is raised when
  *     creating a service.
  * @throws ContainerException if any other error occurs
  */
 public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
 {
     $config = $container->get('config')['phpwkhtmltopdf'];
     $image = new Image(isset($config['images']) ? $config['images'] : null);
     if (isset($options) && isset($options['url'])) {
         $image->setPage($options['url']);
     }
     return $image;
 }
All Usage Examples Of mikehaertl\wkhtmlto\Image::setPage