Solved this myself, but was a pain so thought I'd share the knowledge,
In vendor/magento/module-sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php
in public function draw()
under lines[];
add :
$id = $item->getProductid();
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Catalog\Model\Product')->load($id);
$brand = $product->getAttributeText('manufacturer');
Change manufacturer
to whatever custom attribute code you want.
Quick and dirty – yes I know its a mod of core code and will translate to my own module now it's working, but hope this makes others life easier.
Best Answer
The above solution failed to show some attribute and this is what worked for me:
Add the following code In
in public function draw()
Then draw the Attribute: