コード例 #1
0
 private function setSizesIfOneOfDimensionIsntSet(Node $node, Document $document)
 {
     if ($this->isImageAndSizesArentSet($node)) {
         $width = $node->getWidth();
         $height = $node->getHeight();
         $source = $node->createSource($document);
         $originalWidth = $source->getOriginalWidth();
         $originalHeight = $source->getOriginalHeight();
         $originalRatio = $originalHeight ? $originalWidth / $originalHeight : 0;
         if (!$width && !$height) {
             list($width, $height) = $this->setDimensionsFromParent($source, $node);
         }
         list($width, $height) = Util::calculateDependantSizes($width, $height, $originalRatio);
         $node->setWidth($width);
         $node->setHeight($height);
     }
 }
コード例 #2
0
ファイル: Node.php プロジェクト: zhangxiaoliu/PHPPdf
 protected final function filterBooleanValue($value)
 {
     return Util::convertBooleanValue($value);
 }
コード例 #3
0
ファイル: Engine.php プロジェクト: appotter/phppdf
 public function setMetadataValue($name, $value)
 {
     switch ($name) {
         case 'Trapped':
             $value = $value === 'null' ? null : Util::convertBooleanValue($value);
             $this->getZendPdf()->properties[$name] = $value;
             break;
         case 'CreationDate':
         case 'ModDate':
             $value = PdfDocument::pdfDate(strtotime($value));
             $this->getZendPdf()->properties[$name] = $value;
             break;
         case 'Title':
         case 'Author':
         case 'Subject':
         case 'Keywords':
         case 'Creator':
             $this->getZendPdf()->properties[$name] = $value;
             break;
     }
 }
コード例 #4
0
 protected function convertDegreesToRadians(Node $node)
 {
     $rotate = $node->getAttribute('rotate');
     $radians = Util::convertAngleValue($rotate);
     $node->setAttribute('rotate', $radians);
 }
コード例 #5
0
ファイル: Background.php プロジェクト: zhangxiaoliu/PHPPdf
 private function getImageDimension(UnitConverter $converter, $image, Node $node)
 {
     $width = $converter->convertUnit($this->imageWidth);
     $height = $converter->convertUnit($this->imageHeight);
     if (!$width && !$height) {
         return array($image->getOriginalWidth(), $image->getOriginalHeight());
     }
     list($width, $height) = $this->convertPercentageDimension($converter, $node, $width, $height);
     $ratio = $image->getOriginalWidth() / $image->getOriginalHeight();
     list($width, $height) = Util::calculateDependantSizes($width, $height, $ratio);
     return array($width, $height);
 }
コード例 #6
0
 public function setEqualsColumns($flag)
 {
     $flag = Util::convertBooleanValue($flag);
     $this->setAttributeDirectly('equals-columns', $flag);
 }