I want to change the design and layout of my packing-slip
pdf print-outs
to make a simple and clean print for the employes to work through.
Is there any extension / tutorial / anything else which shows how to make this possible ?
To edit the packing list, or any other PDF docs such as invoice you need to override the files contained within
Magento\Sales\Model\Order\Pdf
For example if wanted to add the price to the packing list
<?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="Magento\Sales\Model\Order\Pdf\Items\Shipment\DefaultShipment"
type="Example\Sales\Model\Order\Pdf\Items\Shipment\DefaultShipment"/>
</config>
Then copy the file "Magento\Sales\Model\Order\Pdf\Items\Shipment\DefaultShipment" to your app/code file, change the name spacing to match the XML above and add the following on around line number 81
// draw item Prices
$i = 0;
$prices = $this->getItemPricesForDisplay();
$feedPrice = 395;
$feedSubtotal = $feedPrice + 70;
$feedTax = $feedSubtotal + 70;
foreach ($prices as $priceData) {
if (isset($priceData['label'])) {
// draw Price label
$lines[$i][] = ['text' => $priceData['label'], 'feed' => $feedPrice, 'align' => 'right'];
// draw Subtotal label
$lines[$i][] = ['text' => $priceData['label'], 'feed' => $feedSubtotal, 'align' => 'right'];
$i++;
}
// draw Price
$lines[$i][] = [
'text' => $priceData['price'],
'feed' => $feedPrice,
'font' => 'bold',
'align' => 'right',
];
// draw Subtotal
$lines[$i][] = [
'text' => $priceData['subtotal'],
'feed' => $feedSubtotal,
'font' => 'bold',
'align' => 'right',
];
$i++;
}
// draw Tax
$lines[0][] = [
'text' => $order->formatPriceTxt($item->getTaxAmount()),
'feed' => $feedTax,
'font' => 'bold',
'align' => 'right',
];
You can take a look at this module https://www.vnecoms.com/magento2-pdf-invoice-pro.html. This module allow you customize your template directly inside backend. Use editor allow you can create template in a few clicks. Support magento 2.2.x
I don't know if you already did this, but for future people that come across this, here is a video that somehow explains it. https://www.youtube.com/watch?v=_baegIF0v48&feature=youtu.be