From 7401ecaf11d6056352d6468c73ee6bdfbb200c1d Mon Sep 17 00:00:00 2001 From: Daniel Marschall <28412477+danielmarschall@users.noreply.github.com> Date: Tue, 9 Jul 2024 22:07:13 +0200 Subject: [PATCH] Fix ZugferdPdfWriter not outputting metadata if there are no files --- src/ZugferdPdfWriter.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ZugferdPdfWriter.php b/src/ZugferdPdfWriter.php index 66daaed..7e32097 100644 --- a/src/ZugferdPdfWriter.php +++ b/src/ZugferdPdfWriter.php @@ -393,11 +393,13 @@ protected function _putcatalog(): void } else { $this->_put(sprintf('/AF %s 0 R', $this->filesIndex)); } + } - if (0 != $this->descriptionIndex) { - $this->_put(sprintf('/Metadata %s 0 R', $this->descriptionIndex)); - } + if (0 != $this->descriptionIndex) { + $this->_put(sprintf('/Metadata %s 0 R', $this->descriptionIndex)); + } + if (!empty($this->files)) { $this->_put('/Names <<'); $this->_put('/EmbeddedFiles '); $this->_put(sprintf('%s 0 R', $this->filesIndex));