Skip to content

Commit

Permalink
return EasyPdf instance for setHeader and setFooter methods
Browse files Browse the repository at this point in the history
  • Loading branch information
frkcn committed Jul 9, 2020
1 parent c120f54 commit 26e3517
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ All notable changes to `easy-pdf` will be documented in this file.

## [Unreleased]

## 1.2.1 - 2020-07-09
- Now `setHeader()` and `setFooter()` methods returns EasyPdf instance.

## 1.2.0 - 2020-06-15
- `reset()` method added for creating new tcpdf instance.

Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,15 @@ $pdf = EasyPdf::reset()
->loadHtml($html) // each load html creates a new page
->content(); // return pdf content as a string
```

### Pdf Header and Setter
After using `reset()` method for creating new Tcpdf instance for each page, automatically header line added to Pdf. Whether you want or not you can use `setHeader' for print header or `setFooter` for print footer content.

```php
$pdf = EasyPdf::reset()
->setHeader(false);
```

### Testing

``` bash
Expand Down
7 changes: 7 additions & 0 deletions src/EasyPdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ public function addBarcode($code, $x, $y, $width, $height, $position = 'N')
* Set Tcpdf print header.
*
* @param null $header
* @return EasyPdf
*/
public function setHeader($header = null)
{
Expand All @@ -242,12 +243,15 @@ public function setHeader($header = null)
}

$this->pdf->setPrintHeader($this->header);

return $this;
}

/**
* Set Tcpdf print footer.
*
* @param null $footer
* @return EasyPdf
*/
public function setFooter($footer = null)
{
Expand All @@ -256,6 +260,8 @@ public function setFooter($footer = null)
}

$this->pdf->setPrintFooter($this->footer);

return $this;
}

/**
Expand Down Expand Up @@ -321,6 +327,7 @@ public static function merge(array $files)
*
* @param string $path
* @return Parser
* @throws Exceptions\UnableToOpen
*/
public static function parser(string $path): Parser
{
Expand Down

0 comments on commit 26e3517

Please sign in to comment.