---
title: "RenderedInvoice – API-Referenz · Quittio"
description: "Rendered invoice for Laravel: usable as mail attachment and as HTTP response, storable on any filesystem disk."
canonical_url: "https://quittio.dev/docs/api/Quittio/Laravel/Rendering/RenderedInvoice"
locale: de
meta:
  "og:description": "Rendered invoice for Laravel: usable as mail attachment and as HTTP response, storable on any filesystem disk."
  "og:image": "https://quittio.dev/og/quittio-de.jpg"
  "og:image:alt": "Quittio: E-Rechnungen für PHP und Laravel. Rechtssicher, validiert, archiviert, mit geprüfter Beispielrechnung."
  "og:image:height": "630"
  "og:image:type": image/jpeg
  "og:image:width": "1200"
  "og:title": "RenderedInvoice – API-Referenz · Quittio"
  "twitter:image": "https://quittio.dev/og/quittio-de.jpg"
  "twitter:image:alt": "Quittio: E-Rechnungen für PHP und Laravel. Rechtssicher, validiert, archiviert, mit geprüfter Beispielrechnung."
---

> Index of every page on this site: [llms.txt](https://quittio.dev/llms.txt)

[API reference](https://quittio.dev/docs/api) / [Quittio](https://quittio.dev/docs/api/Quittio) \\ [Laravel](https://quittio.dev/docs/api/Quittio/Laravel) \\ [Rendering](https://quittio.dev/docs/api/Quittio/Laravel/Rendering)

# RenderedInvoice

final class in quittio/laravel · implements `Illuminate\Contracts\Mail\Attachable`, `Illuminate\Contracts\Support\Responsable` · uses [`DeliversFile`](https://quittio.dev/docs/api/Quittio/Laravel/Rendering/DeliversFile)

`Quittio\Laravel\Rendering\RenderedInvoice` · [Source](https://github.com/Quittio/quittio/blob/v0.7.1/packages/laravel/src/Laravel/Rendering/RenderedInvoice.php#L24)

Rendered invoice for Laravel: usable as mail attachment and as HTTP response, storable on any filesystem disk.

## Methods \#

| Method | Description |
| --- | --- |
| `->__construct()` | |
| `->as()` | The result for another format of the same run. |
| `->cancel()` | Cancels this invoice: builds the cancellation with Quittio::cancellation() and renders it in the formats of this invoice. $lines cancels part of it, $history passes the earlier partial cancellations (see Quittio::cancellation()). |
| `->contents()` | The main output: PDF, otherwise XML, HTML or JSON. |
| `->core()` | The result of the core, e.g. for save() to a local path. |
| `->data()` | The calculated invoice data of the run (totals, VAT breakdown, due date). |
| `->download()` | |
| `->filename()` | File name of the main output, from the configured pattern; $extension replaces the extension of the main output. |
| `->format()` | Key of the format of this result, e.g. "zugferd". |
| `->formats()` | |
| `->hashes()` | |
| `->hasPdf()` | Whether this format produced a PDF. |
| `->hasXml()` | Whether this format produced XML (also the XML embedded in a PDF). |
| `->html()` | The rendered template, as mPDF received it. |
| `->json()` | The invoice as JSON (InvoiceData::toJson()). |
| `->mimeType()` | MIME type of the main output (contents()). |
| `->pdf()` | The PDF. |
| `->profile()` | Profile of the XML; null for formats without XML. |
| `->save()` | Stores the main output on a filesystem disk (default: quittio.storage.disk). |
| `->stream()` | |
| `->toMailAttachment()` | |
| `->toResponse()` | |
| `->validation()` | Validation result of this format; in the mode "warn" it may contain errors, empty in the mode "off". |
| `->xml()` | The e-invoice XML, also the one embedded in the PDF. |

### `__construct()`#

```
public function __construct(RenderedInvoice $result)
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$result` | `[RenderedInvoice](https://quittio.dev/docs/api/Quittio/Core/Rendering/RenderedInvoice)` | |

### `as()`#

```
public function as(string $format): self
```

The result for another format of the same run.

| Parameter | Type | Description |
| --- | --- | --- |
| `$format` | `string` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
<dt>Throws</dt>
<dd><code><a href="https://quittio.dev/docs/api/Quittio/Core/Exceptions/LogicException">LogicException</a></code> – when the format was not rendered in this run</dd></dl>

### `cancel()`#

```
public function cancel(
    string $number,
    ?string $reason = null,
    list<array{line: string, quantity?: BigDecimal|int|string, amount?: string}>|null $lines = null,
    Date|DateTimeInterface|string|null $issueDate = null,
    ?string $strategy = null,
    ?CancellationHistory $history = null,
): self
```

Cancels this invoice: builds the cancellation with Quittio::cancellation() and renders it in the formats of this invoice. $lines cancels part of it, $history passes the earlier partial cancellations (see Quittio::cancellation()).

| Parameter | Type | Description |
| --- | --- | --- |
| `$number` | `string` | |
| `$reason` | `?string` = `null` | |
| `$lines` | `list<array{line: string, Quittio\Laravel\Rendering\quantity?: Brick\Math\BigDecimal\|int\|string, Quittio\Laravel\Rendering\amount?: string}>\|null` = `null` | |
| `$issueDate` | `[Date](https://quittio.dev/docs/api/Quittio/Core/Support/Date)\|DateTimeInterface\|string\|null` = `null` | |
| `$strategy` | `?string` = `null` | |
| `$history` | `? [CancellationHistory](https://quittio.dev/docs/api/Quittio/Core/Corrections/CancellationHistory)` = `null` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `contents()`#

```
public function contents(): string
```

The main output: PDF, otherwise XML, HTML or JSON.

<dl><dt>Returns</dt>
<dd><code>string</code></dd>
</dl>

### `core()`#

```
public function core(): RenderedInvoice
```

The result of the core, e.g. for save() to a local path.

<dl><dt>Returns</dt>
<dd><code><a href="https://quittio.dev/docs/api/Quittio/Core/Rendering/RenderedInvoice">RenderedInvoice</a></code></dd>
</dl>

### `data()`#

```
public function data(): InvoiceData
```

The calculated invoice data of the run (totals, VAT breakdown, due date).

<dl><dt>Returns</dt>
<dd><code><a href="https://quittio.dev/docs/api/Quittio/Core/Data/InvoiceData">InvoiceData</a></code></dd>
</dl>

### `download()`#

```
public function download(?string $filename = null): Response
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$filename` | `?string` = `null` | |

<dl><dt>Returns</dt>
<dd><code>Symfony\Component\HttpFoundation\Response</code></dd>
</dl>

### `filename()`#

```
public function filename(?string $extension = null): string
```

File name of the main output, from the configured pattern; $extension replaces the extension of the main output.

| Parameter | Type | Description |
| --- | --- | --- |
| `$extension` | `?string` = `null` | |

<dl><dt>Returns</dt>
<dd><code>string</code></dd>
</dl>

### `format()`#

```
public function format(): string
```

Key of the format of this result, e.g. "zugferd".

<dl><dt>Returns</dt>
<dd><code>string</code></dd>
</dl>

### `formats()`#

```
public function formats(): list<string>
```

<dl><dt>Returns</dt>
<dd><code>list&lt;string&gt;</code></dd>
</dl>

### `hashes()`#

```
public function hashes(): array<string, string>
```

<dl><dt>Returns</dt>
<dd><code>array&lt;string, string&gt;</code></dd>
</dl>

### `hasPdf()`#

```
public function hasPdf(): bool
```

Whether this format produced a PDF.

<dl><dt>Returns</dt>
<dd><code>bool</code></dd>
</dl>

### `hasXml()`#

```
public function hasXml(): bool
```

Whether this format produced XML (also the XML embedded in a PDF).

<dl><dt>Returns</dt>
<dd><code>bool</code></dd>
</dl>

### `html()`#

```
public function html(): string
```

The rendered template, as mPDF received it.

<dl><dt>Returns</dt>
<dd><code>string</code></dd>
<dt>Throws</dt>
<dd><code><a href="https://quittio.dev/docs/api/Quittio/Core/Exceptions/LogicException">LogicException</a></code> – when the format produced no HTML</dd></dl>

### `json()`#

```
public function json(): string
```

The invoice as JSON (InvoiceData::toJson()).

<dl><dt>Returns</dt>
<dd><code>string</code></dd>
</dl>

### `mimeType()`#

```
public function mimeType(): string
```

MIME type of the main output (contents()).

<dl><dt>Returns</dt>
<dd><code>string</code></dd>
</dl>

### `pdf()`#

```
public function pdf(): string
```

The PDF.

<dl><dt>Returns</dt>
<dd><code>string</code></dd>
<dt>Throws</dt>
<dd><code><a href="https://quittio.dev/docs/api/Quittio/Core/Exceptions/LogicException">LogicException</a></code> – when the format produces no PDF (see hasPdf())</dd></dl>

### `profile()`#

```
public function profile(): ?Profile
```

Profile of the XML; null for formats without XML.

<dl><dt>Returns</dt>
<dd><code>?<a href="https://quittio.dev/docs/api/Quittio/Core/Profiles/Profile">Profile</a></code></dd>
</dl>

### `save()`#

```
public function save(?string $disk = null, ?string $path = null): string
```

Stores the main output on a filesystem disk (default: quittio.storage.disk).

| Parameter | Type | Description |
| --- | --- | --- |
| `$disk` | `?string` = `null` | |
| `$path` | `?string` = `null` | |

<dl><dt>Returns</dt>
<dd><code>string</code> – the stored path</dd>
<dt>Throws</dt>
<dd><code><a href="https://quittio.dev/docs/api/Quittio/Core/Exceptions/RuntimeException">RuntimeException</a></code> – when the disk does not store the file</dd></dl>

### `stream()`#

```
public function stream(?string $filename = null): Response
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$filename` | `?string` = `null` | |

<dl><dt>Returns</dt>
<dd><code>Symfony\Component\HttpFoundation\Response</code></dd>
</dl>

### `toMailAttachment()`#

```
public function toMailAttachment(): Attachment
```

<dl><dt>Returns</dt>
<dd><code>Illuminate\Mail\Attachment</code></dd>
</dl>

### `toResponse()`#

```
public function toResponse(Request $request): Response
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$request` | `Illuminate\Http\Request` | |

<dl><dt>Returns</dt>
<dd><code>Symfony\Component\HttpFoundation\Response</code></dd>
</dl>

### `validation()`#

```
public function validation(): ValidationResult
```

Validation result of this format; in the mode "warn" it may contain errors, empty in the mode "off".

<dl><dt>Returns</dt>
<dd><code><a href="https://quittio.dev/docs/api/Quittio/Core/Validation/ValidationResult">ValidationResult</a></code></dd>
</dl>

### `xml()`#

```
public function xml(): string
```

The e-invoice XML, also the one embedded in the PDF.

<dl><dt>Returns</dt>
<dd><code>string</code></dd>
<dt>Throws</dt>
<dd><code><a href="https://quittio.dev/docs/api/Quittio/Core/Exceptions/LogicException">LogicException</a></code> – when the format produces no XML (see hasXml())</dd></dl>

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://quittio.dev/#website","@type":"WebSite","description":"E-Rechnungen für PHP und Laravel: ZUGFeRD, XRechnung und Peppol erstellen, prüfen, lesen und archivieren.","inLanguage":"de-DE","name":"Quittio","url":"https://quittio.dev/","publisher":{"@id":"https://quittio.dev/#identity"},"workTranslation":{"@id":"https://quittio.dev/en#website"}},{"@id":"https://quittio.dev/docs/api/Quittio/Laravel/Rendering/RenderedInvoice#webpage","@type":"WebPage","description":"Rendered invoice for Laravel: usable as mail attachment and as HTTP response, storable on any filesystem disk.","name":"RenderedInvoice – API-Referenz","url":"https://quittio.dev/docs/api/Quittio/Laravel/Rendering/RenderedInvoice","isPartOf":{"@id":"https://quittio.dev/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://quittio.dev/docs/api/Quittio/Laravel/Rendering/RenderedInvoice"]}],"primaryImageOfPage":{"@id":"https://quittio.dev/#logo"}},{"@id":"https://quittio.dev/#identity","@type":"Organization","description":"Open-Source-Bibliothek für E-Rechnungen in PHP und Laravel (ZUGFeRD, XRechnung, Peppol) und Quittio Managed.","email":"kontakt@niklasforst.de","legalName":"Niklas Forst – Softwareentwicklung","name":"Quittio","url":"https://quittio.dev","founder":{"@type":"Person","name":"Niklas Forst","url":"https://quittio.dev/ueber"},"logo":{"@id":"https://quittio.dev/#logo"},"sameAs":["https://github.com/Quittio/quittio","https://packagist.org/packages/quittio/quittio"]},{"@id":"https://quittio.dev/#logo","@type":"ImageObject","caption":"Quittio","contentUrl":"https://quittio.dev/logo.png","inLanguage":"de-DE","url":"https://quittio.dev/logo.png"}]}
```