PageRenderTime 18ms CodeModel.GetById 15ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/demos/Zend/Service/LiveDocx/MailMerge/pdf-security/generate-document.php

https://github.com/decaoz/zf1
PHP | 42 lines | 26 code | 13 blank | 3 comment | 0 complexity | d513cf9988950c4adc47fb1cd11d3c03 MD5 | raw file
 1<?php
 2
 3require_once dirname(__FILE__) . '/../../common.php';
 4
 5
 6$mailMerge = new Zend_Service_LiveDocx_MailMerge();
 7
 8// Set WSDL of your premium service server
 9$mailMerge->setWsdl('https://api.example.com/1.2/mailmerge.asmx?WSDL');
10
11$mailMerge->setUsername(DEMOS_ZEND_SERVICE_LIVEDOCX_USERNAME)
12          ->setPassword(DEMOS_ZEND_SERVICE_LIVEDOCX_PASSWORD);
13
14$mailMerge->setLocalTemplate('template.docx');
15
16$mailMerge->assign('software', 'Magic Graphical Compression Suite v1.9')
17          ->assign('licensee', 'Henry Döner-Meyer')
18          ->assign('company',  'Co-Operation')
19          ->assign('date',     Zend_Date::now()->toString(Zend_Date::DATE_LONG))
20          ->assign('time',     Zend_Date::now()->toString(Zend_Date::TIME_LONG))
21          ->assign('city',     'Berlin')
22          ->assign('country',  'Germany');
23
24// Available on premium service only 
25$mailMerge->setDocumentPassword('aaaaaaaaaa');
26
27// Available on premium service only
28$mailMerge->setDocumentAccessPermissions(
29    array(
30        'AllowHighLevelPrinting' ,  // getDocumentAccessOptions() returns
31        'AllowExtractContents'      // array of permitted values
32    ),   
33    'myDocumentAccessPassword'
34);
35
36$mailMerge->createDocument();
37
38$document = $mailMerge->retrieveDocument('pdf');
39
40file_put_contents('document.pdf', $document);
41
42unset($mailMerge);