Skip to content

Commit

Permalink
Merge pull request #96 from vintagesucks/default-paper-format
Browse files Browse the repository at this point in the history
fix default paper format in docs
  • Loading branch information
freekmurze committed Mar 4, 2024
2 parents b263e83 + 35a8f31 commit f0042df
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/basic-usage/formatting-pdfs.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Pdf::view('pdf.invoice', ['invoice' => $invoice])

## Paper format

By default, all PDFs are created in A4 format. You can change this by calling the `format` method.
By default, all PDFs are created in Letter format. You can change this by calling the `format` method.

```php
use Spatie\LaravelPdf\Facades\Pdf;
Expand Down
6 changes: 6 additions & 0 deletions tests/DefaultPdfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
->toContainText('test');
});

it('defaults to the letter format', function () {
Pdf::view('test')->save($this->targetPath);

expect($this->targetPath)->toHaveDimensions(612, 792);
});

it('will not use properties of the previous pdf when not setting a default', function () {
$firstPath = getTempPath('first.pdf');
Pdf::html('test')
Expand Down
2 changes: 1 addition & 1 deletion tests/PdfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
expect(getTempPath('first.pdf'))
->toHaveDimensions(792, 612);

// second pdf is landscape
// second pdf is portrait
expect(getTempPath('second.pdf'))
->toHaveDimensions(612, 792);
});
Expand Down

0 comments on commit f0042df

Please sign in to comment.