Skip to content

Commit

Permalink
Updates to release v1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed Jun 20, 2017
1 parent efa2a84 commit 150890a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
2 changes: 1 addition & 1 deletion CHANGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Change Log: `yii2-mpdf`

## Version 1.0.2

**Date:** 17-Jun-2017
**Date:** 20-Jun-2017

- (enh #45, #51): Updates dependency to use latest mPdf 7.x development branch.

Expand Down
39 changes: 18 additions & 21 deletions Pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class Pdf extends Component
public $destination = self::DEST_BROWSER;
/**
* @var string the folder path for storing the temporary data generated by mpdf.
* If not set this defaults to `Yii::getAlias('@runtime/mpdf')`.
* If not set this defaults to path `Yii::getAlias('@runtime/mpdf')` which will be created if it does not exist.
*/
public $tempPath;
/**
Expand Down Expand Up @@ -208,7 +208,8 @@ class Pdf extends Component
*/
protected static function definePath($prop, $dir)
{
if (defined($prop)) {
$propDir = constant($prop);
if (defined($prop) && is_writable($propDir)) {
return;
}
$status = true;
Expand All @@ -233,6 +234,8 @@ public function init()

/**
* Initialize folder paths to allow [[Mpdf]] to write temporary data.
*
* @throws InvalidConfigException
*/
public function initTempPaths()
{
Expand Down Expand Up @@ -277,26 +280,21 @@ public function getApi()
*/
public function setApi()
{
$config = array_replace_recursive(
$this->options,
[
'mode' => $this->mode,
'format' => $this->format,
'default_font_size' => $this->defaultFontSize,
'default_font' => $this->defaultFont,
'mgl' => $this->marginLeft,
'mgr' => $this->marginRight,
'mgt' => $this->marginTop,
'mgb' => $this->marginBottom,
'mgh' => $this->marginHeader,
'mgf' => $this->marginFooter,
'orientation' => $this->orientation,
]
);
$this->options['mode'] = $this->mode;
$this->options['format'] = $this->format;
$this->options['default_font_size'] = $this->defaultFontSize;
$this->options['default_font'] = $this->defaultFont;
$this->options['mgl'] = $this->marginLeft;
$this->options['mgr'] = $this->marginRight;
$this->options['mgt'] = $this->marginTop;
$this->options['mgb'] = $this->marginBottom;
$this->options['mgh'] = $this->marginHeader;
$this->options['mgf'] = $this->marginFooter;
$this->options['orientation'] = $this->orientation;
if (isset($this->tempPath) && is_dir($this->tempPath)) {
$config['tempDir'] = $this->tempPath;
$this->options['tempDir'] = $this->tempPath;
}
$this->_mpdf = new Mpdf($config);
$this->_mpdf = new Mpdf($this->options);
}

/**
Expand Down Expand Up @@ -420,5 +418,4 @@ private function writePdfAttachment($api, $attachment)
$api->UseTemplate($templateId);
}
}

}

2 comments on commit 150890a

@hagenr
Copy link

@hagenr hagenr commented on 150890a Jun 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  •    $propDir = constant($prop);
    

Throws
constant(): Couldn't find constant _MPDF_TEMP_PATH

after latest composer update. Am I missing something?

@kartik-v
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved via #59

Please sign in to comment.