Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add hideHeader and hideFooter #23

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/PdfBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ class PdfBuilder implements Responsable

public ?array $margins = null;

public bool $hideHeader = false;

public bool $hideFooter = false;

protected ?Closure $customizeBrowsershot = null;

protected array $responseHeaders = [
Expand Down Expand Up @@ -192,6 +196,20 @@ public function margins(
return $this;
}

public function hideHeader(): self
{
$this->hideHeader = true;

return $this;
}

public function hideFooter(): self
{
$this->hideFooter = true;

return $this;
}

public function format(string|Format $format): self
{
if ($format instanceof Format) {
Expand Down Expand Up @@ -317,6 +335,14 @@ protected function getBrowsershot(): Browsershot
}
}

if ($this->hideHeader) {
$browsershot->hideHeader();
}

if ($this->hideFooter) {
$browsershot->hideFooter();
}

if ($this->margins) {
$browsershot->margins(...$this->margins);
}
Expand Down