Magento 2 FreeSerif.ttf Virus detection by google / gmail with order or invoice pdf

By | May 2, 2023
Spread the love

Magento 2 FreeSerif.ttf Virus detection by google / gmail with order or invoice pdf

Google have recently added more security and added as virus category to font FreeSerif.ttf. We have to update magento font lib/internal/LinLibertineFont/LinLibertine_Re-4.4.1.ttf  to fix that error.

<?php
namespace Techgroup\PrintOrderPdf\Model\Pdf;

abstract class AbstractPdfOverride extends \Magento\Sales\Model\Order\Pdf\AbstractPdf
{
    /**
    * 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::fontWithPath(
            $this->_rootDirectory->getAbsolutePath('lib/internal/LinLibertineFont/LinLibertine_Re-4.4.1.ttf')
        );
        
        $object->setFont($font, $size);
        return $font;
    }
}