Q:

Custom Invoice PDF

I'm trying to customize the PDF exported by Magento 2 but getting some issues:

etc/di.xml

<preference for="Magento\Sales\Model\Order\Pdf\AbstractPdf" 
            type="Vendor\Module\Model\Order\Pdf\AbstractPdf" />

Even after recompiling with bin/magento setup:di:compile, nothing seems to change when I download an invoice PDF (tested with exit("test"); in the constructor of the class). 
So I tried also overriding Magento\Sales\Model\Order\Pdf\Invoice and this time, an error is thrown in the apache error.log:
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Magento\\Sales\\Model\\Order\\Pdf\\Items\\AbstractItems::setPdf() must be an instance of Magento\\Sales\\Model\\Order\\Pdf\\AbstractPdf, instance of Vendor\\Module\\Model\\Order\\Pdf\\Invoice given, called in /var/www/html/app/code/Vendor/Module/Model/Order/Pdf/AbstractPdf.php on line 841 and defined in /var/www/html/vendor/magento/module-sales/Model/Order/Pdf/Items/AbstractItems.php:139\nStack trace:

#0 /var/www/html/app/code/Vendor/Module/Model/Order/Pdf/AbstractPdf.php(841): Magento\\Sales\\Model\\Order\\Pdf\\Items\\AbstractItems->setPdf(Object(Vendor\\Module\\Model\\Order\\Pdf\\Invoice))

#1 /var/www/html/app/code/Vendor/Module/Model/Order/Pdf/Invoice.php(159): Vendor\\Module\\Model\\Order\\Pdf\\AbstractPdf->_drawItem(Object(Magento\\Sales\\Model\\Order\\Invoice\\Item), Object(Zend_Pdf_Page), Object(Magento\\Sales\\Model\\Order\\Interceptor))

#2 /var/www/html/vendor/magento/module-sales/Controller/Adminhtml/Invoice/AbstractInvoice/PrintAction.php(57): Vendor\\Module\\Model\\Order\\Pdf\\Invoice->getPdf(Array)

A:

From the first error message, I assume that your custom model does not extend from Magento\Sales\Model\Order\Pdf\AbstractPdf.  This should be the case.