<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM /** * Image Source: * iStock_000003413016Medium_business-man-with-hands-up.jpg */ $photoFilename = __DIR__ . '/dailemaitre.jpg'; $photoFile = basename($photoFilename); if (!$mailMerge->imageExists($photoFile)) { // pass image file *without* path $mailMerge->uploadImage($photoFilename); // pass image file *with* path } $mailMerge->setLocalTemplate('template.docx'); $mailMerge->assign('name', 'Daï Lemaitre')->assign('company', 'Megasoft Co-operation')->assign('date', Helper::currentDate())->assign('image:photo', $photoFile); // pass image file *without* path $mailMerge->createDocument(); $document = $mailMerge->retrieveDocument('pdf'); file_put_contents('document.pdf', $document); $mailMerge->deleteImage($photoFilename); unset($mailMerge);
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; Helper::printLine(PHP_EOL . 'Uploading Locally Stored Templates to Server' . PHP_EOL . PHP_EOL); $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM print 'Uploading template... '; $mailMerge->uploadTemplate('template-1.docx'); print 'DONE.' . PHP_EOL; print 'Uploading template... '; $mailMerge->uploadTemplate('template-2.docx'); print 'DONE.' . PHP_EOL; print PHP_EOL; unset($mailMerge);
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; Helper::printLine(PHP_EOL . 'Checking For Remotely Stored Templates' . PHP_EOL . PHP_EOL); $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM print 'Checking whether a template is available... '; if (true === $mailMerge->templateExists('template-1.docx')) { print 'EXISTS. '; } else { print 'DOES NOT EXIST. '; } print 'DONE' . PHP_EOL; print PHP_EOL; unset($mailMerge);
* distribution. */ $zfRoot = realpath(dirname(__DIR__)); $zfCoreLibrary = "{$zfRoot}/library"; /* * Prepend the Zend Framework library/ and demos/ directories to the * include_path. This allows the demos to run out of the box and helps prevent * loading other copies of the framework code and demos that would supersede * this copy. */ $path = array($zfCoreLibrary, get_include_path()); set_include_path(implode(PATH_SEPARATOR, $path)); /** * Setup autoloading */ include_once __DIR__ . '/_autoload.php'; /** * Set fallback locale */ Locale::setDefault(Helper::LOCALE); /** * Ensure LiveDocx credentials are available */ if (false === Helper::credentialsAvailable()) { Helper::printLine(Helper::credentialsHowTo()); exit; } /* * Unset global variables that are no longer needed. */ unset($zfRoot, $zfCoreLibrary, $path);
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_PASSWORD)->setService(MailMerge::SERVICE_PREMIUM); $mailMerge->setLocalTemplate('template.docx'); $mailMerge->assign('software', 'Magic Graphical Compression Suite v1.9')->assign('licensee', 'Henry Döner-Meyer')->assign('company', 'Co-Operation')->assign('date', Helper::currentDate())->assign('time', Helper::currentTime())->assign('city', 'Berlin')->assign('country', 'Germany'); // Available on premium service only $mailMerge->setDocumentPassword('aaaaaaaaaa'); // Available on premium service only $mailMerge->setDocumentAccessPermissions(array('AllowHighLevelPrinting', 'AllowExtractContents'), 'myDocumentAccessPassword'); $mailMerge->createDocument(); $document = $mailMerge->retrieveDocument('pdf'); file_put_contents('document.pdf', $document); unset($mailMerge);
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; Helper::printLine(PHP_EOL . 'Downloading Remotely Stored Templates' . PHP_EOL . PHP_EOL); $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM $counter = 1; foreach ($mailMerge->listTemplates() as $result) { printf('%d) %s', $counter, $result['filename']); $template = $mailMerge->downloadTemplate($result['filename']); file_put_contents('downloaded-' . $result['filename'], $template); print ' - DOWNLOADED.' . PHP_EOL; $counter++; } print PHP_EOL; unset($mailMerge);
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; Helper::printLine(PHP_EOL . 'Checking For Remotely Stored Images' . PHP_EOL . PHP_EOL); $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM print 'Checking whether an image is available... '; if (true === $mailMerge->imageExists('image-01.png')) { print 'EXISTS. '; } else { print 'DOES NOT EXIST. '; } print 'DONE' . PHP_EOL; print PHP_EOL; unset($mailMerge);
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; Helper::printLine(PHP_EOL . 'Remotely Stored Images' . PHP_EOL . PHP_EOL . 'The following images are currently stored on the LiveDocx server:' . PHP_EOL . PHP_EOL); $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM print Helper::listDecorator($mailMerge->listImages()); unset($mailMerge);
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM $mailMerge->setLocalTemplate('template.doc'); $mailMerge->assign('customer_number', sprintf("#%'10s", rand(0, 1000000000)))->assign('invoice_number', sprintf("#%'10s", rand(0, 1000000000)))->assign('account_number', sprintf("#%'10s", rand(0, 1000000000))); $billData = array('phone' => '+22 (0)333 444 555', 'date' => Helper::currentDate(), 'name' => 'James Henry Brown', 'service_phone' => '+22 (0)333 444 559', 'service_fax' => '+22 (0)333 444 558', 'month' => Helper::currentMonthYear(), 'monthly_fee' => '15.00', 'total_net' => '19.60', 'tax' => '19.00', 'tax_value' => '3.72', 'total' => '23.32'); $mailMerge->assign($billData); $billConnections = array(array('connection_number' => '+11 (0)222 333 441', 'connection_duration' => '00:01:01', 'fee' => '1.15'), array('connection_number' => '+11 (0)222 333 442', 'connection_duration' => '00:01:02', 'fee' => '1.15'), array('connection_number' => '+11 (0)222 333 443', 'connection_duration' => '00:01:03', 'fee' => '1.15'), array('connection_number' => '+11 (0)222 333 444', 'connection_duration' => '00:01:04', 'fee' => '1.15')); $mailMerge->assign('connection', $billConnections); $mailMerge->createDocument(); $document = $mailMerge->retrieveDocument('pdf'); unset($mailMerge); file_put_contents('document.pdf', $document);
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; Helper::printLine(PHP_EOL . 'Deleting All Remotely Stored Images' . PHP_EOL . PHP_EOL); $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM $counter = 1; foreach ($mailMerge->listImages() as $result) { printf('%d) %s', $counter, $result['filename']); $mailMerge->deleteImage($result['filename']); print ' - DELETED.' . PHP_EOL; $counter++; } print PHP_EOL; unset($mailMerge);
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\MailMerge; use ZendService\LiveDocx\DemoHelper as Helper; Helper::printLine(PHP_EOL . 'Document Access Options' . PHP_EOL . PHP_EOL . 'Documents can be protected using one or more document access option:' . PHP_EOL . PHP_EOL); $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_PASSWORD)->setService(MailMerge::SERVICE_PREMIUM); Helper::printLine(implode(', ', $mailMerge->getDocumentAccessOptions()) . '.' . PHP_EOL . PHP_EOL); unset($mailMerge);
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; Helper::printLine(PHP_EOL . 'Using LiveDocx Free' . PHP_EOL . PHP_EOL . 'This sample application illustrates how to use the Zend Framework LiveDocx component with the LiveDocx Free.' . PHP_EOL . PHP_EOL); // ----------------------------------------------------------------------------- // Pass login credentials using set methods $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM $mailMerge->getTemplateFormats(); // then call methods as usual printf('Username : %s%sPassword : %s%s WSDL : %s%s%s', $mailMerge->getUsername(), PHP_EOL, $mailMerge->getPassword(), PHP_EOL, $mailMerge->getWsdl(), PHP_EOL, PHP_EOL); unset($mailMerge); // ----------------------------------------------------------------------------- // Pass login credentials using constructor $mailMerge = new MailMerge(); $mailMerge = new MailMerge(array('username' => DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME, 'password' => DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD, 'service' => MailMerge::SERVICE_FREE)); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM $mailMerge->getTemplateFormats(); // then call methods as usual printf('Username : %s%sPassword : %s%s WSDL : %s%s%s', $mailMerge->getUsername(), PHP_EOL, $mailMerge->getPassword(), PHP_EOL, $mailMerge->getWsdl(), PHP_EOL, PHP_EOL); unset($mailMerge); // -----------------------------------------------------------------------------
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; Helper::printLine(PHP_EOL . 'Remotely Stored Templates' . PHP_EOL . PHP_EOL . 'The following templates are currently stored on the LiveDocx server:' . PHP_EOL . PHP_EOL); $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM print Helper::listDecorator($mailMerge->listTemplates()); unset($mailMerge);
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; Helper::printLine(PHP_EOL . 'Field and Block Field Names (merge fields)' . PHP_EOL . PHP_EOL . 'The following templates contain the listed field or block field names:' . PHP_EOL . PHP_EOL); $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM // ----------------------------------------------------------------------------- $templateName = 'template-1-text-field.docx'; $mailMerge->setLocalTemplate($templateName); printf('Field names in %s:%s', $templateName, PHP_EOL); $fieldNames = $mailMerge->getFieldNames(); foreach ($fieldNames as $fieldName) { printf('- %s%s', $fieldName, PHP_EOL); } // ----------------------------------------------------------------------------- $templateName = 'template-2-text-fields.doc'; $mailMerge->setLocalTemplate($templateName); printf('%sField names in %s:%s', PHP_EOL, $templateName, PHP_EOL); $fieldNames = $mailMerge->getFieldNames(); foreach ($fieldNames as $fieldName) { printf('- %s%s', $fieldName, PHP_EOL); } // ----------------------------------------------------------------------------- $templateName = 'template-block-fields.doc'; $mailMerge->setLocalTemplate($templateName); printf('%sField names in %s:%s', PHP_EOL, $templateName, PHP_EOL); $fieldNames = $mailMerge->getFieldNames(); foreach ($fieldNames as $fieldName) {
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM $mailMerge->setLocalTemplate('template.docx'); $mailMerge->setFieldValue('software', 'Magic Graphical Compression Suite v1.9')->setFieldValue('licensee', 'Henry Döner-Meyer')->setFieldValue('company', 'Megasoft Co-operation')->setFieldValue('date', Helper::currentDate())->setFieldValue('time', Helper::currentTime())->setFieldValue('city', 'Bremen')->setFieldValue('country', 'Germany'); $mailMerge->createDocument(); // Get all metafiles $metaFiles = $mailMerge->getAllMetafiles(); // Get just metafiles in specified range //$metaFiles = $mailMerge->getMetafiles(1, 2); // fromPage, toPage foreach ($metaFiles as $pageNumber => $metaFileData) { $filename = sprintf('document-page-%d.wmf', $pageNumber); file_put_contents($filename, $metaFileData); } unset($mailMerge);
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM Helper::printLine(PHP_EOL . 'Supported Fonts' . PHP_EOL . PHP_EOL . 'The following fonts are installed on the backend server and may be used in templates. Fonts used in templates, which are NOT listed below, will be substituted. If you would like to use a font, which is not installed on the backend server, please contact your LiveDocx provider.' . PHP_EOL . PHP_EOL . Helper::arrayDecorator($mailMerge->getFontNames()) . PHP_EOL . PHP_EOL); unset($mailMerge);
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; Helper::printLine(PHP_EOL . 'Using LiveDocx Fully Licensed' . PHP_EOL . PHP_EOL . 'This sample application illustrates how to use the Zend Framework LiveDocx component with the LiveDocx running in your own network.' . PHP_EOL . PHP_EOL); // ----------------------------------------------------------------------------- // Pass login credentials using set methods $mailMerge = new MailMerge(); $mailMerge->setUsername('your-username')->setPassword('your-password')->setWsdl('http://api.example.com/2.1/mailmerge.asmx?wsdl'); // set the WSDL of your locally installed, // LiveDocx Fully Licensed server here $mailMerge->getTemplateFormats(); // then call methods as usual printf('Username : %s%sPassword : %s%s WSDL : %s%s%s', $mailMerge->getUsername(), PHP_EOL, $mailMerge->getPassword(), PHP_EOL, $mailMerge->getWsdl(), PHP_EOL, PHP_EOL); unset($mailMerge); // ----------------------------------------------------------------------------- // Pass login credentials using constructor $mailMerge = new MailMerge(); $mailMerge = new MailMerge(array('username' => 'your-username', 'password' => 'your-password', 'wsdl' => 'http://api.example.com/2.1/mailmerge.asmx?wsdl')); // set the WSDL of your // LiveDocx Fully Licensed server here $mailMerge->getTemplateFormats(); // then call methods as usual printf('Username : %s%sPassword : %s%s WSDL : %s%s%s', $mailMerge->getUsername(), PHP_EOL, $mailMerge->getPassword(), PHP_EOL, $mailMerge->getWsdl(), PHP_EOL, PHP_EOL); unset($mailMerge); // -----------------------------------------------------------------------------
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; Helper::printLine(PHP_EOL . 'Template, Document and Image Formats' . PHP_EOL . PHP_EOL . 'The following formats are supported by LiveDocx:' . PHP_EOL . PHP_EOL); $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM printf("Supported TEMPLATE file formats (input) : %s%s", Helper::arrayDecorator($mailMerge->getTemplateFormats()), PHP_EOL); printf("Supported DOCUMENT file formats (output) : %s%s", Helper::arrayDecorator($mailMerge->getDocumentFormats()), PHP_EOL); printf("Supported IMAGE file formats (output) : %s%s", Helper::arrayDecorator($mailMerge->getImageExportFormats()), PHP_EOL); print PHP_EOL; unset($mailMerge);
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM $mailMerge->setLocalTemplate('template.docx'); $mailMerge->assign('software', 'Magic Graphical Compression Suite v1.9')->assign('licensee', 'Daï Lemaitre')->assign('company', 'Megasoft Co-operation')->assign('date', Helper::currentDate())->assign('time', Helper::currentTime())->assign('city', 'Lyon')->assign('country', 'France'); $mailMerge->createDocument(); // Get all bitmaps $bitmaps = $mailMerge->getAllBitmaps(100, 'png'); // zoomFactor, format // Get just bitmaps in specified range //$bitmaps = $mailMerge->getBitmaps(2, 2, 100, 'png'); // fromPage, toPage, zoomFactor, format foreach ($bitmaps as $pageNumber => $bitmapData) { $filename = sprintf('document-page-%d.png', $pageNumber); file_put_contents($filename, $bitmapData); } unset($mailMerge);
if (is_dir($tempDirectory)) { recursiveRemoveDirectory($tempDirectory); } $logger->log(Logger::INFO, sprintf('Making temporary directory %s.', $tempDirectory)); mkdir($tempDirectory); // ----------------------------------------------------------------------------- // Generate temporary documents $tempFilenames = array(); $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM; $mailMerge->setLocalTemplate('template.docx'); for ($iteration = 1; $iteration <= $iterations; $iteration++) { $tempFilename = sprintf('%s%s%010s.pdf', $tempDirectory, DIRECTORY_SEPARATOR, $iteration); $tempFilenames[] = $tempFilename; $mailMerge->assign('software', randomString())->assign('licensee', randomString())->assign('company', randomString())->assign('date', Helper::currentDate())->assign('time', Helper::currentTime())->assign('city', randomString())->assign('country', randomString()); $mailMerge->createDocument(); file_put_contents($tempFilename, $mailMerge->retrieveDocument('pdf')); $logger->log(Logger::INFO, sprintf('Generating temporary document %s.', $tempFilename)); } unset($mailMerge); // ----------------------------------------------------------------------------- // Concatenate temporary documents and write output document $outputFilename = __DIR__ . DIRECTORY_SEPARATOR . 'document-concat.pdf'; $logger->log(Logger::INFO, 'Concatenating temporary documents...'); if (true === concatenatePdfFilenames($tempFilenames, $outputFilename, $processor, $logger)) { $logger->log(Logger::INFO, sprintf('...DONE. Saved output document as %s.', basename($outputFilename))); } else { $logger->log(Logger::ERR, sprintf('...ERROR.')); } // -----------------------------------------------------------------------------
$counter++; // ----------------------------------------------------------------------------- if (defined('DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_USERNAME') && defined('DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_PASSWORD') && false !== DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_USERNAME && false !== DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_PASSWORD) { $errorMessage = null; try { $microtime = microtime(true); $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_PREMIUM_PASSWORD)->setService(MailMerge::SERVICE_PREMIUM)->listTemplates(); $duration = microtime(true) - $microtime; unset($mailMerge); } catch (Exception $e) { $duration = -1; $errorMessage = $e->getMessage(); } if (is_null($errorMessage)) { $result = TEST_PASS; } else { $result = TEST_FAIL; $failed = true; } Helper::printLineToc($counter, sprintf('Logging into LiveDocx Premium (%01.2fs)', $duration), $result); $counter++; } // ----------------------------------------------------------------------------- if (true === $failed) { $message = 'One or more tests failed. The web server environment, in which this script is running, does not meet the requirements for ZendService_LiveDocx.'; } else { $message = 'Congratulations! All required tests passed. The server environment, in which this script is running, is suitable for ZendService_LiveDocx.'; } Helper::printLine(PHP_EOL . $message . PHP_EOL . PHP_EOL); // -----------------------------------------------------------------------------
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; Helper::printLine(PHP_EOL . 'Downloading Remotely Stored Images' . PHP_EOL . PHP_EOL); $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM $counter = 1; foreach ($mailMerge->listImages() as $result) { printf('%d) %s', $counter, $result['filename']); $image = $mailMerge->downloadImage($result['filename']); file_put_contents('downloaded-' . $result['filename'], $image); print ' - DOWNLOADED.' . PHP_EOL; $counter++; } print PHP_EOL; unset($mailMerge);
<?php include_once realpath('../../../../Bootstrap.php'); use ZendService\LiveDocx\DemoHelper as Helper; use ZendService\LiveDocx\MailMerge; Helper::printLine(PHP_EOL . 'Deleting All Remotely Stored Templates' . PHP_EOL . PHP_EOL); $mailMerge = new MailMerge(); $mailMerge->setUsername(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_USERNAME)->setPassword(DEMOS_ZENDSERVICE_LIVEDOCX_FREE_PASSWORD)->setService(MailMerge::SERVICE_FREE); // for LiveDocx Premium, use MailMerge::SERVICE_PREMIUM $counter = 1; foreach ($mailMerge->listTemplates() as $result) { printf('%d) %s', $counter, $result['filename']); $mailMerge->deleteTemplate($result['filename']); print ' - DELETED.' . PHP_EOL; $counter++; } print PHP_EOL; unset($mailMerge);