@param string|array $paper
@param string $orientation
@param string $class

@return Canvas
426531
static function get_instance($paper = null, $orientation = null,  $class = null) {

    $backend = strtolower(DOMPDF_PDF_BACKEND);
    
    if ( isset($class) && class_exists($class, false) )
      $class .= "_Adapter";
    
    else if ( (DOMPDF_PDF_BACKEND === "auto" || $backend === "pdflib" ) &&
              class_exists("PDFLib", false) )
      $class = "PDFLib_Adapter";

    // FIXME The TCPDF adapter is not ready yet
    //else if ( (DOMPDF_PDF_BACKEND === "auto" || $backend === "cpdf") )
    //  $class = "CPDF_Adapter";

    else if ( $backend === "tcpdf")
      $class = "TCPDF_Adapter";
      
    else if ( $backend === "gd" )
      $class = "GD_Adapter";
    
    else
      $class = "CPDF_Adapter";

    return new $class($paper, $orientation);
        
  }
1051414
function polygon($points, $color, $width = null, $style = null, $fill = false) {

    $this->_set_fill_color($color);
    $this->_set_stroke_color($color);

    if ( !$fill && isset($width) )
      $this->_set_line_style($width, "square", "miter", $style);

    $y = $this->y(array_pop($points));
    $x = array_pop($points);
    $this->_pdf->moveto($x,$y);

    while (count($points) > 1) {
      $y = $this->y(array_pop($points));
      $x = array_pop($points);
      $this->_pdf->lineto($x,$y);
    }

    if ( $fill )
      $this->_pdf->fill();
    else
      $this->_pdf->closepath_stroke();
  }
782709
public function checkPaperEvaluated(Paper $paper)
    {
        $fullyEvaluated = $this->repository->isFullyEvaluated($paper);
        if ($fullyEvaluated) {
            $event = new LogExerciseEvaluatedEvent($paper->getExercise(), [
                'result' => $paper->getScore(),
                'resultMax' => $this->calculateTotal($paper),
            ]);

            $this->eventDispatcher->dispatch('log', $event);
        }

        return $fullyEvaluated;
    }
274903
private function addPage(array $options = array())
    {
        // Add new page to the document
        if (strtoupper($options['size'] = 'LETTER') && strtoupper($options['orientation']) == 'LANDSCAPE') {
            $this->_page = $this->_pdf->newPage(ZfPdf\Page::SIZE_LETTER_LANDSCAPE);
        } elseif (strtoupper($options['size'] = 'LETTER') && strtoupper($options['orientation']) != 'LANDSCAPE') {
            $this->_page = $this->_pdf->newPage(ZfPdf\Page::SIZE_LETTER);
        } elseif (strtoupper($options['size'] != 'A4') && strtoupper($options['orientation']) == 'LANDSCAPE') {
            $this->_page = $this->_pdf->newPage(ZfPdf\Page::SIZE_A4_LANDSCAPE);
        } else {
            $this->_page = $this->_pdf->newPage(ZfPdf\Page::SIZE_A4);
        }

        $this->_page->setStyle($this->_style);
        $this->_pdf->pages[] = $this->_page;
        $this->_page->setFont($this->_font, 14);

        return $this;
    }
642359
public function set($route, $orientation)
    {
        $this->ensureStorage();

        $this->storage[$route] = $orientation;
        $this->saveStorage();
    }
1285681
protected function wrapInCallable($class, array $parameters = [])
    {

        return function ($container) use ($class, $parameters) {

            //if reflection class has a constructor
            if (($constructor = $class->getConstructor()) !== null) { //will return null if no constructor;
                //The container will always be passed as the last argument to the constructor;
                if (($required = $constructor->getNUmberOfParameters()) > 0) { //int

                    $dependencies = $constructor->getParameters();
                    $passed = count($parameters);
                    $needfrom = ($required - $passed) > 0 ? (($passed - 1) < 0 ? 0 : $passed - 1) : $required;

                    for ($i = $needfrom; $i < $required; $i++) {
                        $parameter = $dependencies[$i]; //instance of ReflectionParamter;
                        //If this parameter has not been passed, and the default value is not defined
                        if (!$parameter->isOptional() && !$parameter->isDefaultValueAvailable()) {

                            $hintedType = $parameter->getClass();
                            $hintedTypeName = $hintedType->getName();
                            //$hintedInstance = null;

                            //$hintedType = $reflectionException = null;
                            try {
                                //if the required class exists in the container


                                //If its not in the container, we will try to load it;
                                if ($hintedType->isInstantiable()) {
                                    $hintedInstance =
                                        ($hintedType->getName() == "Budkit\\Dependency\\Container") ? $container
                                            : $container->createInstance($hintedType->getName());
                                    array_push($parameters, $hintedInstance);

                                }
                            } catch (ReflectionException $reflectionException) {

                                //print_R($hintedInstance); die;

                                throw new ReflectionException(
                                    sprintf('The %1s Class requires parameter number %2s which could not be located. %3s',
                                        $class->getName(), ($i + 1) . " of type {" . $hintedTypeName . "}", $reflectionException->getMessage())
                                );
                            }
                        }
                        //if this parameter has not been passed but we have default values
                        if ($parameter->isDefaultValueAvailable()) {
                            array_push($parameters, $parameter->getDefaultValue());
                        }
                    }
                }

                //var_dump($class, $parameters, "<br />");
                return $class->newInstanceArgs($parameters);
            }

            return $class->newInstanceWithoutConstructor();
        };
    }
1229874
public function viewHint(Paper $paper, Hint $hint)
    {
        $log = $this->om->getRepository('UJMExoBundle:LinkHintPaper')
            ->findOneBy(['paper' => $paper, 'hint' => $hint]);

        if (!$log) {
            $log = new LinkHintPaper($hint, $paper);
            $this->om->persist($log);
            $this->om->flush();
        }

        return $hint->getValue();
    }
953549
def add_page(self, orientation=''):
        ""
        if(self.state==0):
            self.open()
        family=self.font_family
        if self.underline:
            style = self.font_style + 'U'
        else:
            style = self.font_style
        size=self.font_size_pt
        lw=self.line_width
        dc=self.draw_color
        fc=self.fill_color
        tc=self.text_color
        cf=self.color_flag
        if(self.page>0):
            #Page footer
            self.in_footer=1
            self.footer()
            self.in_footer=0
            #close page
            self._endpage()
        #Start new page
        self._beginpage(orientation)
        #Set line cap style to square
        self._out('2 J')
        #Set line width
        self.line_width=lw
        self._out(sprintf('%.2f w',lw*self.k))
        #Set font
        if(family):
            self.set_font(family,style,size)
        #Set colors
        self.draw_color=dc
        if(dc!='0 G'):
            self._out(dc)
        self.fill_color=fc
        if(fc!='0 g'):
            self._out(fc)
        self.text_color=tc
        self.color_flag=cf
        #Page header
        self.header()
        #Restore line width
        if(self.line_width!=lw):
            self.line_width=lw
            self._out(sprintf('%.2f w',lw*self.k))
        #Restore font
        if(family):
            self.set_font(family,style,size)
        #Restore colors
        if(self.draw_color!=dc):
            self.draw_color=dc
            self._out(dc)
        if(self.fill_color!=fc):
            self.fill_color=fc
            self._out(fc)
        self.text_color=tc
        self.color_flag=cf
603946
function definePaperOrientation (options) {
  var paper = {border: options.border || '0'}

  if (options.height && options.width) {
    paper.width = options.width
    paper.height = options.height
  } else {
    paper.format = options.format || 'A4'
    paper.orientation = options.orientation || 'portrait'
  }

  return paper
}
729505
public function fetch($style = null, $orientation = null, $offset = null)
    {
        set_error_handler(array($this->_pdooci,"errorHandler"));
        try {
            $style = is_null($style) ? $this->_fetch_sty : $style;
            $this->_fetch_sty = $style;
            $rst   = null;

            switch ($style)
            {
            case \PDO::FETCH_BOTH:
            case \PDO::FETCH_BOUND:
                $rst = \oci_fetch_array($this->_stmt, \OCI_BOTH + \OCI_RETURN_NULLS);
                break;
            case \PDO::FETCH_ASSOC:
                $rst = \oci_fetch_array($this->_stmt, \OCI_ASSOC + \OCI_RETURN_NULLS);
                $rst = $this->_fixResultKeys($rst);
                break;
            case \PDO::FETCH_NUM:
                $rst = \oci_fetch_array($this->_stmt, \OCI_NUM + \OCI_RETURN_NULLS);
                break;
            case \PDO::FETCH_OBJ:
                $rst = \oci_fetch_object($this->_stmt);
                break;
            }
            $this->_current = $rst;
            $this->_checkBinds();
        } catch (\Exception $e) {
            throw new \PDOException($e->getMessage());
        }
        restore_error_handler();
        return $rst;
    }
411909
public function invertDock($orientation = '')
    {
        // Return value
        if (empty($orientation)) {
            return $this->invertDock;
        }

        // Set value
        $this->invertDock = $orientation;

        return $this;
    }
744831
static function get_instance(Dompdf $dompdf, $paper = null, $orientation = null, $class = null)
    {
        $backend = strtolower($dompdf->getOptions()->getPdfBackend());

        if (isset($class) && class_exists($class, false)) {
            $class .= "_Adapter";
        } else {
            if (($backend === "auto" || $backend === "pdflib") &&
                class_exists("PDFLib", false)
            ) {
                $class = "Dompdf\\Adapter\\PDFLib";
            }

            else {
                if ($backend === "gd" && extension_loaded('gd')) {
                    $class = "Dompdf\\Adapter\\GD";
                } else {
                    $class = "Dompdf\\Adapter\\CPDF";
                }
            }
        }

        return new $class($paper, $orientation, $dompdf);
    }
180341
protected static function createFacade($class='', $args=[])
    {
        $class=$class ?: static::class;
        $facadeClass=static::getFacadeClass();
        if ($facadeClass) {
            $class=$facadeClass;
        } elseif (isset(self::$bind[$class])) {
            $class=self::$bind[$class];
        }
        return Container::getInstance()->make($class, $args);
    }
249787
public static function canvas(
        string $content = null, 
        array $attributes = []
    ) : string
    {
        return self::tag("canvas", $content, $attributes);
    }
1257263
function FPDF($orientation='P', $unit='mm', $format='A4')
{
	//Some checks
	$this->_dochecks();
	//Initialization of properties
	$this->page=0;
	$this->n=2;
	$this->buffer='';
	$this->pages=array();
	$this->PageSizes=array();
	$this->state=0;
	$this->fonts=array();
	$this->FontFiles=array();
	$this->diffs=array();
	$this->images=array();
	$this->links=array();
	$this->InHeader=false;
	$this->InFooter=false;
	$this->lasth=0;
	$this->FontFamily='';
	$this->FontStyle='';
	$this->FontSizePt=12;
	$this->underline=false;
	$this->DrawColor='0 G';
	$this->FillColor='0 g';
	$this->TextColor='0 g';
	$this->ColorFlag=false;
	$this->ws=0;
	//Standard fonts
	$this->CoreFonts=array('courier'=>'Courier', 'courierB'=>'Courier-Bold', 'courierI'=>'Courier-Oblique', 'courierBI'=>'Courier-BoldOblique',
		'helvetica'=>'Helvetica', 'helveticaB'=>'Helvetica-Bold', 'helveticaI'=>'Helvetica-Oblique', 'helveticaBI'=>'Helvetica-BoldOblique',
		'times'=>'Times-Roman', 'timesB'=>'Times-Bold', 'timesI'=>'Times-Italic', 'timesBI'=>'Times-BoldItalic',
		'symbol'=>'Symbol', 'zapfdingbats'=>'ZapfDingbats');
	//Scale factor
	if($unit=='pt')
		$this->k=1;
	elseif($unit=='mm')
		$this->k=72/25.4;
	elseif($unit=='cm')
		$this->k=72/2.54;
	elseif($unit=='in')
		$this->k=72;
	else
		$this->Error('Incorrect unit: '.$unit);
	//Page format
	$this->PageFormats=array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28),
		'letter'=>array(612,792), 'legal'=>array(612,1008));
	if(is_string($format))
		$format=$this->_getpageformat($format);
	$this->DefPageFormat=$format;
	$this->CurPageFormat=$format;
	//Page orientation
	$orientation=strtolower($orientation);
	if($orientation=='p' || $orientation=='portrait')
	{
		$this->DefOrientation='P';
		$this->w=$this->DefPageFormat[0];
		$this->h=$this->DefPageFormat[1];
	}
	elseif($orientation=='l' || $orientation=='landscape')
	{
		$this->DefOrientation='L';
		$this->w=$this->DefPageFormat[1];
		$this->h=$this->DefPageFormat[0];
	}
	else
		$this->Error('Incorrect orientation: '.$orientation);
	$this->CurOrientation=$this->DefOrientation;
	$this->wPt=$this->w*$this->k;
	$this->hPt=$this->h*$this->k;
	//Page margins (1 cm)
	$margin=28.35/$this->k;
	$this->SetMargins($margin,$margin);
	//Interior cell margin (1 mm)
	$this->cMargin=$margin/10;
	//Line width (0.2 mm)
	$this->LineWidth=.567/$this->k;
	//Automatic page break
	$this->SetAutoPageBreak(true,2*$margin);
	//Full width display mode
	$this->SetDisplayMode('fullwidth');
	//Enable compression
	$this->SetCompression(true);
	//Set default PDF version number
	$this->PDFVersion='1.3';
}
1091400
protected static function getSelfUrl(array &$mappedClass)
    {
        if (empty($mappedClass[static::URLS_KEY][static::SELF_KEY])) {
            throw new MappingException(
                'Could not find "self" property under "urls". This is required in order to make the resource to be reachable.'
            );
        }

        return $mappedClass[static::URLS_KEY][static::SELF_KEY];
    }
672281
public function withIntermediate($class, array $columns = ['*'], $accessor = null)
    {
        /** @var \Illuminate\Database\Eloquent\Model $instance */
        $instance = new $class;

        $accessor = $accessor ?: Str::snake(class_basename($class));

        return $this->withPivot($instance->getTable(), $columns, $class, $accessor);
    }