PHP code example of awakenweb / livedocx

1. Go to this page and download the library: Download awakenweb/livedocx library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

awakenweb / livedocx example snippets




use Awakenweb\Livedocx\Soap\Client;
use Awakenweb\Livedocx\Livedocx;
use Awakenweb\Livedocx\Container;

// for free accounts:
$wsdl = 'https://api.livedocx.com/2.1/mailmerge.asmx?wsdl';
// for premium:
$wsdl = "https://premium01.livedocx.com/REPLACE_THIS_BY_YOUR_USERNAME/mailmerge.asmx?WSDL"
// for fully licensed: only you may know

$soap = new Client(new \SoapClient($wsdl));
$soap->connect(USERNAME, PASSWORD);
$Livedocx = new Livedocx($soap, new Container();

$livedocx->assign(array(
    'somefieldname'  => 'some value',
    'someOtherField' => 'another value'
    )
);

$remoteTemplate = $livedocx->createRemoteTemplate();
$remoteTemplate->setName('myTemplate.docx')
               ->setAsActive();

$document = $livedocx->prepare();
$document->setPassword('$3CR3T');
$document->create();

file_put_contents('myPdfFile.pdf', $document->retrieve('pdf'));