generate-document.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/php
  2. <?php
  3. require_once dirname(__FILE__) . '/../../common.php';
  4. $phpLiveDocx = new Zend_Service_LiveDocx_MailMerge();
  5. // Set WSDL of your premium service server
  6. $phpLiveDocx->setWsdl('https://api.example.com/1.2/mailmerge.asmx?WSDL');
  7. $phpLiveDocx->setUsername(Demos_Zend_Service_LiveDocx_Helper::USERNAME)
  8. ->setPassword(Demos_Zend_Service_LiveDocx_Helper::PASSWORD);
  9. $phpLiveDocx->setLocalTemplate('template.docx');
  10. $phpLiveDocx->assign('software', 'Magic Graphical Compression Suite v1.9')
  11. ->assign('licensee', 'Henry Döner-Meyer')
  12. ->assign('company', 'Co-Operation')
  13. ->assign('date', Zend_Date::now()->toString(Zend_Date::DATE_LONG))
  14. ->assign('time', Zend_Date::now()->toString(Zend_Date::TIME_LONG))
  15. ->assign('city', 'Berlin')
  16. ->assign('country', 'Germany');
  17. // Available on premium service only
  18. $phpLiveDocx->setDocumentPassword('aaaaaaaaaa');
  19. // Available on premium service only
  20. $phpLiveDocx->setDocumentAccessPermissions(
  21. array(
  22. 'AllowHighLevelPrinting' , // getDocumentAccessOptions() returns
  23. 'AllowExtractContents' // array of permitted values
  24. ),
  25. 'myDocumentAccessPassword'
  26. );
  27. $phpLiveDocx->createDocument();
  28. $document = $phpLiveDocx->retrieveDocument('pdf');
  29. file_put_contents('document.pdf', $document);
  30. unset($phpLiveDocx);