Download the PHP package enflow/document-replacer without Composer
On this page you can find all versions of the php package enflow/document-replacer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download enflow/document-replacer
More information about enflow/document-replacer
Files in enflow/document-replacer
Package document-replacer
Short Description Modify docx templates and convert them to PDF
License MIT
Homepage https://github.com/enflow-nl/document-replacer
Informations about the package document-replacer
Modify docx templates and convert them to PDF
The enflow/document-replacer
package provides a easy way to modify docx templates, replace text and save it. Adds the ability to export it to PDF trough unoserver/unoconvert.
Installation
You can install the package via composer:
PDF conversion
This package comes with an implementation to convert docx templates to PDF using unoserver. You can install this on your machine globally using:
Converters
It's highly recommend using the new unoconvert
converter. If you are unable to upgrade, we still provide the deprecated UnoconvConverter
for the time being. UnoconvConverter
is deprecated and will be removed in 3.0.
Server
Unoserver works together with unoconvert. Unoserver runs as a daemon on the server, and unoconvert connects through it to pass the files. To see why this is more efficient, see https://github.com/unoconv/unoserver/#overview
Start the server with:
unoserver --daemon
It's recommended setting this up with a server like supervisord, without the --daemon
flag, to auto restart the process if needed.
Usage
Images
If you wish to replace images in your document, you can pass the Image
class to the replacement array like this:
The search-pattern model for images can be like:
${search-image-pattern}
${search-image-pattern:[width]:[height]:[ratio]}
${search-image-pattern:[width]x[height]}
${search-image-pattern:size=[width]x[height]}
${search-image-pattern:width=[width]:height=[height]:ratio=false}
Where:- [width] and [height] can be just numbers or numbers with measure, which supported by Word (cm|mm|in|pt|pc|px|%|em|ex)
- [ratio] uses only for
false
,-
orf
to turn off respect aspect ration of image. By default template image size uses as 'container' size.
More info can be found in the PHPWord
documentation
Non-default server options
Running the server on non-default options (IP 127.0.0.1 / port 2002)? You can pass along the interface and port to the UnoserverConverter
:
Testing
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Michel Bardelmeijer
- All Contributors
About Enflow
Enflow is a digital creative agency based in Alphen aan den Rijn, Netherlands. We specialize in developing web applications, mobile applications and websites. You can find more info on our website.
License
The MIT License (MIT). Please see License File for more information.