https://github.com/mtcextendee/mautic-badge-generator-bundle
Badge PDF generator
https://github.com/mtcextendee/mautic-badge-generator-bundle
extendee mautic mautic-api mautic-plugin mautic-theme
Last synced: 5 months ago
JSON representation
Badge PDF generator
- Host: GitHub
- URL: https://github.com/mtcextendee/mautic-badge-generator-bundle
- Owner: mtcextendee
- Created: 2019-03-16T20:19:30.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-02-23T13:07:25.000Z (about 3 years ago)
- Last Synced: 2024-08-03T17:15:19.560Z (9 months ago)
- Topics: extendee, mautic, mautic-api, mautic-plugin, mautic-theme
- Language: PHP
- Homepage: https://mtcextendee.com
- Size: 136 KB
- Stars: 10
- Watchers: 4
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-mautic - mtcextendee/mautic-badge-generator-bundle - Badge PDF generator (Plugins)
README
# Mautic Badge Generator for Mautic
Plugin from Mautic Extension family ([https://mtcextendee.com](https://mtcextendee.com/))
Download 7 ultimate free Mautic email themes https://mtcextendee.com/themes/
In general, plugin modify any PDF and add new text custom slots and barcode to PDF. Useful for your events.
### Features
- Add with custom text slots to PDF
- Custom contact fields
- Custom font-size, color and position
- Add barcode to PDF
- Require https://github.com/mtcextendee/mautic-barcode-generator-bundle
- Any custom contact field to generate Barcode
- Custom position and width/height of barcode
- Add QRcode to PDF
- Require https://github.com/mtcextendee/mautic-barcode-generator-bundle
- Any custom contact field to generate QRcode
- Custom position and width/height of barcode, color etc.
- Token support - use link to badge in email/page (`{badge=1}`)
- Add to stage after download generate PDF
- Generate custom PDF for each contacts from contact list
- Display badge generator bundle just for contact with certain tags## Installation
#### Installation from command line:
1. `composer require mtcextendee/mautic-badge-generator-bundle`
1. `php app/console mautic:plugins:reload`Manual installation is not allowed because plugins depend on another setasign/fpdi-tcpdf, which is installed automatically from command line.
## Setup
Just go to plugins and enable new BadgeGenerator integration. Then you should see new column in left menu.

### Generate PDF
In contact list

### Before

### After

### API
Library: https://github.com/mautic/api-library
Hook
```php
$api = new \Mautic\Api\Api($auth, $apiUrl);
$contactId = 1;
$badgeId = 2;
$response = $api->makeRequest(sprintf("badge/generator/%d/%d", $contactId, $badgeId));
```Example for Basic Authorization:
```php
// Bootup the Composer autoloader
include __DIR__.'/vendor/autoload.php';use Mautic\Auth\ApiAuth;
$apiUrl = 'http://mautic.site';
$settings = [
'userName' => 'admin',
'password' => 'mautic',
];
$initAuth = new ApiAuth();
$auth = $initAuth->newAuth($settings, 'BasicAuth');
$api = new \Mautic\Api\Api($auth, $apiUrl);
$contactId = 1;
$badgeId = 2;
$response = $api->makeRequest(sprintf("badge/generator/%d/%d", $contactId, $badgeId));
if (isset($response['pdf'])) {
$result = base64_decode($response['pdf']);
// Write on file
file_put_contents('test.pdf', $result);
echo 'PDF created';
} elseif (isset($response['errors'][0]['message'])) {
echo $response['errors'][0]['message'];
}
```Response:
- If badge exist for contact
`$response['pdf'] = 'base64 encode of PDF content';`
You need base64decode of PDF content and then process it (dispay or save..). For more info check: https://selectpdf.com/web-html-to-pdf-rest-api-for-php-samples/
- If badge or contact not exist:
`$response['errors']`