---
title: "LogoCache – API-Referenz · Quittio"
description: "Prepares logos for the PDF and caches the result."
canonical_url: "https://quittio.dev/docs/api/Quittio/Core/Pdf/LogoCache"
locale: de
meta:
  "og:description": "Prepares logos for the PDF and caches the result."
  "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": "LogoCache – 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) \\ [Pdf](https://quittio.dev/docs/api/Quittio/Core/Pdf)

# LogoCache

final readonly class in quittio/core

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

Prepares logos for the PDF and caches the result.

mPDF never fetches a logo itself: remote images (http and https only) are downloaded by `RemoteImageFetcher` from public hosts and cached as local files; other stream wrappers are refused. Logos may be local files (configuration), data URIs or such URLs.

Without PDF/A, large raster files are scaled once to the size used in the PDF; SVG must be self-contained. For PDF/A (ZUGFeRD/Factur-X), which allows neither the alpha channel mPDF would write nor mPDF's SVG output (ISO 19005-3, 6.2.2), every logo is re-encoded as RGB PNG on white: raster images are flattened, SVG is rasterised with Imagick.

## Methods \#

| Method | Description |
| --- | --- |
| `->__construct()` | |
| `->resolve()` | A value for the renderer that can never trigger a server-side request: a local file ({@see realpath()}) for existing files, or a canonical data URI built from bytes this class has decoded and checked itself (for http(s) URLs and data URIs). Null if a remote logo cannot be downloaded. Everything else is refused. |

### `__construct()`#

```
public function __construct(
    string $directory,
    int $maxWidth = 600,
    int $maxHeight = 200,
    bool $pdfa = false,
    ?RemoteImageFetcher $fetcher = null,
)
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$directory` | `string` | |
| `$maxWidth` | `int` = `600` | |
| `$maxHeight` | `int` = `200` | |
| `$pdfa` | `bool` = `false` | |
| `$fetcher` | `? [RemoteImageFetcher](https://quittio.dev/docs/api/Quittio/Core/Pdf/RemoteImageFetcher)` = `null` | |

### `resolve()`#

```
public function resolve(?string $logo): ?string
```

A value for the renderer that can never trigger a server-side request: a local file ({@see realpath()}) for existing files, or a canonical data URI built from bytes this class has decoded and checked itself (for http(s) URLs and data URIs). Null if a remote logo cannot be downloaded. Everything else is refused.

| Parameter | Type | Description |
| --- | --- | --- |
| `$logo` | `?string` | |

<dl><dt>Returns</dt>
<dd><code>?string</code></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/Pdf/LogoCache#webpage","@type":"WebPage","description":"Prepares logos for the PDF and caches the result.","name":"LogoCache – API-Referenz","url":"https://quittio.dev/docs/api/Quittio/Core/Pdf/LogoCache","isPartOf":{"@id":"https://quittio.dev/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://quittio.dev/docs/api/Quittio/Core/Pdf/LogoCache"]}],"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"}]}
```