Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README: Add more info about PDFreactor #5

Merged
merged 2 commits into from
Apr 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,78 @@ This pdfreactor recipe for [ddev](https://ddev.readthedocs.io) installs a [`.dde
* The PDFreactor instance will listen on TCP port 9423 (the PDFreactor default).
* Configure your application to access PDFreactor on the host:port `pdfreactor:9423`.

## Example to use this PDFreactor service with the official PDFreactor Web Service PHP client

```php
<?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 infos: [https://www.pdfreactor.com/php/](https://www.pdfreactor.com/php/)

## Example to use this PDFreactor service with Pimcore

1. Install Pimcore demo
```
mkdir -p pimcore-demo
cd pimcore-demo
ddev config --project-type=php --docroot=public --webserver-type=apache-fpm --create-docroot --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
```
2. Install ddev-pdfreactor Addon
```
ddev get blankse/ddev-pdfreactor
ddev restart
```
3. Config
1. When you have a PDFreactor license key you can add this to `.ddev/pdfreactor/licensekey.txt`
2. Login to the admin interface https://pimcore-demo.ddev.site/admin (Username: admin, Password: demo)
3. Go to the Web2Print settings

![Web-to-print settings menu](images/web-to-print-settings-menu.jpg)

4. Set the config and click the save button

| Setting | Value |
|----------|-------------------------------|
| Tool | PDFreactor |
| Protocol | http |
| Server | pdfreactor |
| Port | 9423 |
| BaseURL | http://pimcore-demo.ddev.site |

4. Test a Print document
1. Execute Maintenance Worker:

`ddev php bin/console messenger:consume pimcore_core pimcore_maintenance`

3. Go to the demo Print catalog (/print/Demo-Catalog)
4. Click to "Generate PDF" button

## License

ddev-pdfreactor is distributed under the [Apache 2.0 license](LICENSE).
Expand Down
Binary file added images/web-to-print-settings-menu.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.