PDF Designer Add-On
Visual drag & drop PDF layout editor for quote exports.
This add-on is:
- Composer package:
mageb2b/b2b-quote-pdfdesigner - Magento module:
MageB2B_B2BQuotePdfDesigner
What You Get
- Visual layout editor in the Magento admin
- Layout storage (DB) + repository
- Variable system (built-in + extendable via providers)
- Rendering pipeline (PDF renderer + element renderers)
Screenshot placeholder: custom layout tile in the selector
File:./_screenshots/pdf-custom-layout.png
Installation
1) Require package
composer config bearer.repo.softwaresilo.io <token>
composer config repositories.softwaresilo composer https://repo.softwaresilo.io/
composer require mageb2b/b2b-quote-pdfdesigner:*
2) Enable module + run setup
php bin/magento module:enable MageB2B_B2BQuotePdfDesigner
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento cache:flush
Where To Configure It (Admin)
- PDF layout selector: Stores → Configuration → MageB2B → B2B Quote → PDF Settings
- config key:
b2bquote/pdf/pdf_layout
- config key:
See:
Screenshot placeholder: PDF designer UI / layout editor
File:./_screenshots/pdf-designer-ui.png
Variables
Variables are resolved during PDF generation.
Template Syntax
Variables use {{variable_code}} with optional formatting:
{{my_variable}} // Raw value
{{my_variable|uppercase}} // UPPERCASE
{{my_variable|date:Y-m-d}} // Custom date format
{{my_variable|currency}} // Currency format
{{my_variable|truncate:50}} // Max 50 chars
Variable Types
| Type | Description |
|---|---|
string |
Plain text |
number |
Numeric value |
currency |
Money amount (formatted) |
date |
Date/time (formatted) |
Adding Custom Variables (Developer)
Third-party modules can add custom variables to the designer UI by registering a variable provider.
1) Create a Variable Provider
<?php
declare(strict_types=1);
namespace Vendor\Module\Model\Variable\Provider;
use MageB2B\B2BQuotePdfDesigner\Api\VariableProviderInterface;
use MageB2B\B2BQuotePdfDesigner\Model\Variable\VariableDefinition;
class CustomProvider implements VariableProviderInterface
{
public function getCategoryCode(): string
{
return 'custom';
}
public function getCategoryLabel(): string
{
return (string)__('CUSTOM');
}
public function getSortOrder(): int
{
return 100;
}
public function getVariables(): array
{
return [
new VariableDefinition(
code: 'my_variable',
label: __('My Variable'),
description: __('Description for UI'),
type: 'string' // string, number, currency, date
),
];
}
public function canResolve(string $variableCode): bool
{
return $variableCode === 'my_variable';
}
public function resolve(string $variableCode, array $context): mixed
{
$quote = $context['quote'] ?? null;
$store = $context['store'] ?? null;
return match ($variableCode) {
'my_variable' => 'resolved value',
default => ''
};
}
}
2) Register the Provider (DI)
<type name="MageB2B\B2BQuotePdfDesigner\Model\Variable\ProviderPool">
<arguments>
<argument name="providers" xsi:type="array">
<item name="custom" xsi:type="object">Vendor\Module\Model\Variable\Provider\CustomProvider</item>
</argument>
</arguments>
</type>
Context Data
The $context array contains:
quote(B2B quote model)store(store model)page_number(current page number)page_count(total pages)
Troubleshooting
UI Not Loading / Missing JS
php bin/magento setup:static-content:deploy
php bin/magento cache:flush
See also: