---
title: "RenderedInvoice – API-Referenz · Quittio"
description: "Result of a render run. With several formats, every format is reachable via {@see self::as()}; all share the same calculation."
canonical_url: "https://quittio.dev/docs/api/Quittio/Core/Rendering/RenderedInvoice"
locale: de
meta:
  "og:description": "Result of a render run. With several formats, every format is reachable via {@see self::as()}; all share the same calculation."
  "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) \\ [Core](https://quittio.dev/docs/api/Quittio/Core) \\ [Rendering](https://quittio.dev/docs/api/Quittio/Core/Rendering)

# RenderedInvoice

final class in quittio/core

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

Result of a render run. With several formats, every format is reachable via {@see self::as()}; all share the same calculation.

## Methods \#

| Method | Description |
| --- | --- |
| `->__construct()` | |
| `->as()` | The result for another format of the same run. |
| `->contents()` | The main output: PDF, otherwise XML, HTML or JSON. |
| `->data()` | The calculated invoice data of the run (totals, VAT breakdown, due date). |
| `->extension()` | Extension of the main output (contents()): pdf, xml, html or json. |
| `->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()` | SHA-256 hashes of the outputs, e.g. for archiving. |
| `->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()` | Writes the main output. A directory as target uses {@see self::filename()}. |
| `->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(
    InvoiceData $data,
    string $format,
    ?Profile $profile,
    ValidationResult $validation,
    string $filenamePattern,
    ?string $xml = null,
    ?string $pdf = null,
    ?string $html = null,
    ?string $json = null,
)
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$data` | `[InvoiceData](https://quittio.dev/docs/api/Quittio/Core/Data/InvoiceData)` | |
| `$format` | `string` | |
| `$profile` | `? [Profile](https://quittio.dev/docs/api/Quittio/Core/Profiles/Profile)` | |
| `$validation` | `[ValidationResult](https://quittio.dev/docs/api/Quittio/Core/Validation/ValidationResult)` | |
| `$filenamePattern` | `string` | file name with the placeholder {ext} |
| `$xml` | `?string` = `null` | |
| `$pdf` | `?string` = `null` | |
| `$html` | `?string` = `null` | |
| `$json` | `?string` = `null` | |

### `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>
</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>

### `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>

### `extension()`#

```
public function extension(): string
```

Extension of the main output (contents()): pdf, xml, html or json.

<dl><dt>Returns</dt>
<dd><code>string</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>
```

SHA-256 hashes of the outputs, e.g. for archiving.

<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 $path): string
```

Writes the main output. A directory as target uses {@see self::filename()}.

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

<dl><dt>Returns</dt>
<dd><code>string</code> – the written path</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/Core/Rendering/RenderedInvoice#webpage","@type":"WebPage","description":"Result of a render run. With several formats, every format is reachable via {@see self::as()}; all share the same calculation.","name":"RenderedInvoice – API-Referenz","url":"https://quittio.dev/docs/api/Quittio/Core/Rendering/RenderedInvoice","isPartOf":{"@id":"https://quittio.dev/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://quittio.dev/docs/api/Quittio/Core/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"}]}
```