瀏覽代碼

As requested by community, re-added 'convert' LiveDocx demo

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20592 44c647ce-9c0f-0410-b52a-842ac1e357ba
jonathan_maron 16 年之前
父節點
當前提交
a90e53da11

+ 36 - 0
demos/Zend/Service/LiveDocx/MailMerge/convert/convert-document.php

@@ -0,0 +1,36 @@
+<?php
+
+require_once dirname(__FILE__) . '/../../common.php';
+
+
+/**
+ * Converting documents between supported formats
+ * 
+ * The primary goal of Zend_Service_LiveDocx_MailMerge is to populate templates
+ * with textual data to generate word processing documents. It can, however,
+ * also be used to convert word processing documents between supported formats.
+ * 
+ * For a list of supported file formats see: http://is.gd/6YKDu
+ * 
+ * In this demo application, the file 'document.doc' is converted to 'document.pdf'
+ * 
+ * In a future version of the LiveDocx service, a converter component will be
+ * made available.
+ */
+
+$phpLiveDocx = new Zend_Service_LiveDocx_MailMerge();
+
+$phpLiveDocx->setUsername(DEMOS_ZEND_SERVICE_LIVEDOCX_USERNAME)
+            ->setPassword(DEMOS_ZEND_SERVICE_LIVEDOCX_PASSWORD);
+
+$phpLiveDocx->setLocalTemplate('document.doc');
+
+$phpLiveDocx->assign('dummyFieldName', 'dummyFieldValue'); // necessary as of LiveDocx 1.2
+
+$phpLiveDocx->createDocument();
+
+$document = $phpLiveDocx->retrieveDocument('pdf');
+
+file_put_contents('document.pdf', $document);
+
+unset($phpLiveDocx);

二進制
demos/Zend/Service/LiveDocx/MailMerge/convert/document.doc