Try creating same methods which you want to override from AbstractPdf.php in your overided Invoice.php file. For example, if you want to change the font:
- Create a preference for Invoice.php in di.xml
<preference for="Magento\Sales\Model\Order\Pdf\Invoice" type="Vendor\Module\Model\Order\Pdf\Invoice" />
In Vendor\Module\Model\Order\Pdf\Invoice, in you case create a function _setFontRegularmethod insertOrder
/**
- Set font as regularInsert order to pdf page
- @param \Zend_Pdf_Page $object\Zend_Pdf_Page &$page
- @param int $size\Magento\Sales\Model\Order $obj
- @param bool $putOrderId
- @return \Zend_Pdf_Resource_Fontvoid
- @SuppressWarnings(PHPMD.CyclomaticComplexity)
- @SuppressWarnings(PHPMD.NPathComplexity)
- @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ protected function _setFontRegularinsertOrder($object&$page, $size$obj, $putOrderId = 7true) { $font = \Zend_Pdf_Font::fontWithPath( $this->getFontsDir() . ('your-font-name') ); $object->setFont($font, $size); return $font;// comment relevent code according to your requirement }