di.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="Fooman\EmailAttachments\Observer\BeforeSendInvoiceObserver" type="Myvendorfolder\EmailAttachments\Observer\BeforeSendInvoiceObserver" />
<virtualType name="myvendorfolder_emailattachments_invoice_pdf_renderer" type="\Myvendorfolder\EmailAttachments\Model\PdfRenderer">
<arguments>
<argument name="pdfRenderer" xsi:type="object">\Magento\Sales\Model\Order\Pdf\Invoice</argument>
</arguments>
</virtualType>
<type name="\Myvendorfolder\EmailAttachments\Observer\AbstractSendInvoiceObserver">
<arguments>
<argument name="pdfRenderer" xsi:type="object">myvendorfolder_emailattachments_invoice_pdf_renderer</argument>
</arguments>
</type>
</config>
events.xml
<?xml version="1.0"?>
<!--
/**
* @author Kristof Ringleff
* @package Fooman_EmailAttachments
* @copyright Copyright (c) 2015 Fooman Limited (http://www.fooman.co.nz)
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<!--Invoice Emails-->
<event name="myvendorfolder_emailattachments_before_send_invoice">
<observer name="myvendorfolder_emailattachments_before_send_invoice_observer"
instance="Myvendorfolder\EmailAttachments\Observer\BeforeSendInvoiceObserver"/>
</event>
</config>
module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Myvendorfolder_EmailAttachments" setup_version="2.1.0">
<sequence>
<module name="Fooman_EmailAttachments"/>
</sequence>
</module>
</config>