From 7940dee6de6311fa893ec9b9bed6726bd2c44097 Mon Sep 17 00:00:00 2001 From: alainc-be Date: Tue, 15 Sep 2026 22:45:54 +0200 Subject: [PATCH] Correct Font Encryption (issue 185) --- src/Cpdf.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Cpdf.php b/src/Cpdf.php index daf710d..53c06d2 100644 --- a/src/Cpdf.php +++ b/src/Cpdf.php @@ -1130,8 +1130,11 @@ private function o_fontGIDtoCIDMap($id, $action, $options = '') $tmp = gzcompress($tmp, $this->options['compression']); $res .= ' /Filter /FlateDecode'; } - - $res .= ' /Length '.mb_strlen($tmp, '8bit')." >>\nstream\n$tmp\nendstream"; + if ($this->encryptionMode > 0) { + $this->encryptInit($id); + $tmp = $this->ARC4($tmp); + } + $res .= ' /Length '.mb_strlen($tmp, '8bit')." >>\nstream\n$tmp\nendstream"; } $res .= "\nendobj";