This repository allows you to quickly install PDFreactor into a DDEV project using just ddev get blankse/ddev-pdfreactor
.
For DDEV v1.23.5 or above run
ddev add-on get blankse/ddev-pdfreactor
For earlier versions of DDEV run
ddev get blankse/ddev-pdfreactor
Then restart your project
ddev restart
This PDFreactor recipe for DDEV installs a .ddev/docker-compose.pdfreactor.yaml
using the realobjects/pdfreactor
Docker image.
- The PDFreactor instance will listen on TCP port 9423 (the PDFreactor default).
- Configure your application to access PDFreactor on the host:port
pdfreactor:9423
.
<?php
// Include PDFreactor class
// You can download the PDFreactor Web Service PHP client from:
// http://www.pdfreactor.com/download/get/?product=pdfreactor&type=webservice_clients&jre=false
require_once('PDFreactor.class.php');
use com\realobjects\pdfreactor\webservice\client\PDFreactor;
use com\realobjects\pdfreactor\webservice\client\PDFreactorWebserviceException;
// Create new PDFreactor instance
$pdfReactor = new PDFreactor('http://pdfreactor:9423/service/rest');
$config = [
// Specify the input document
'document'=> 'http://www.pdfreactor.com/product/samples/textbook/textbook.html',
];
// Render document and save result to $result
$result = null;
try {
$result = $pdfReactor->convertAsBinary($config);
header('Content-Type: application/pdf');
echo $result;
} catch (PDFreactorWebserviceException $e) {
echo '<h1>An Error Has Occurred</h1>';
echo '<h2>' . $e->getMessage() . '</h2>';
}
More info: https://www.pdfreactor.com/php/
- Install Pimcore demo
mkdir -p pimcore-demo
cd pimcore-demo
ddev config --project-type=php --docroot=public --webserver-type=apache-fpm --php-version=8.0 --database=mariadb:10.5
ddev composer create -y -n pimcore/demo
ddev exec php vendor/pimcore/pimcore/bin/pimcore-install --admin-username admin --admin-password demo --mysql-host-socket db --mysql-username db --mysql-password db --mysql-database db --no-interaction
- Install ddev-pdfreactor Addon
ddev get blankse/ddev-pdfreactor
ddev restart
-
Config
- When you have a PDFreactor license key you can add this to
.ddev/pdfreactor/licensekey.txt
- Login to the admin interface https://pimcore-demo.ddev.site/admin (Username: admin, Password: demo)
- Go to the Web2Print settings
- Set the config and click the save button
Setting Value Tool PDFreactor Protocol http Server pdfreactor Port 9423 BaseURL http://pimcore-demo.ddev.site - When you have a PDFreactor license key you can add this to
-
Test a Print document
-
Execute Maintenance Worker:
ddev php bin/console messenger:consume pimcore_core pimcore_maintenance
-
Go to the demo Print catalog (/print/Demo-Catalog)
-
Click to "Generate PDF" button
-
ddev-pdfreactor is distributed under the Apache 2.0 license.
Contributed and maintained by @blankse