Zend certified PHP/Magento developer

How to compress PDF of invoice shipment and Creditmemo

In Magento 2.4.1 I developed below code to compress the PDF and it was working fine
Recently I updated Magento to 2.4.6-p3 and now compression stoped working.

app/code/Vendor/CompressPDF/etc.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="MagentoSalesModelOrderPdfInvoice"
                type="VendorCompressPDFModelSalesOrderPdfInvoice" />
    
</config>

app/code/Vendor/CompressPDF/Model/Sales/Order/Pdf

<?php

namespace VendorCompressPDFModelSalesOrderPdf;

class Invoice extends MagentoSalesModelOrderPdfInvoice
{
    /**
     * Set Font as Regular
     *
     * @param  Zend_Pdf_Page $object
     * @param  int $size
     * @return Zend_Pdf_Resource_Font
     */
    protected function _setFontRegular($object, $size = 7)
    {
        $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
        $object->setFont($font, $size);
        return $font;
    }

    /**
     * Set Font as Bold
     *
     * @param  Zend_Pdf_Page $object
     * @param  int $size
     * @return Zend_Pdf_Resource_Font
     */
    protected function _setFontBold($object, $size = 7)
    {
        $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_BOLD);
        $object->setFont($font, $size);
        return $font;
    }

    /**
     * Set Font as Italic
     *
     * @param  Zend_Pdf_Page $object
     * @param  int $size
     * @return Zend_Pdf_Resource_Font
     */
    protected function _setFontItalic($object, $size = 7)
    {
        $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_ITALIC);
        $object->setFont($font, $size);
        return $font;
    }
}