当前位置: 首页>>代码示例>>PHP>>正文


PHP Folder::getFile方法代码示例

本文整理汇总了PHP中Folder::getFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::getFile方法的具体用法?PHP Folder::getFile怎么用?PHP Folder::getFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Folder的用法示例。


在下文中一共展示了Folder::getFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: appendDocument

 /**
  * Appends a list of documents to this one.
  * @param string $appendDocs (List of documents to append)
  * @param string $importFormatModes
  * @param string $sourceFolder (name of the folder where documents are present)
  */
 public function appendDocument($appendDocs, $importFormatModes, $sourceFolder)
 {
     try {
         //check whether required information is complete
         if (count($appendDocs) != count($importFormatModes)) {
             throw new Exception("Please specify complete documents and import format modes");
         }
         //Build JSON to post
         $json = '{ "DocumentEntries": [';
         for ($i = 0; $i < count($appendDocs); $i++) {
             $json .= '{ "Href": "' . $sourceFolder . $appendDocs[$i] . '", "ImportFormatMode": "' . $importFormatModes[$i] . '" }' . ($i < count($appendDocs) - 1 ? ',' : '');
         }
         $json .= '  ] }';
         //build URI to merge Docs
         $strURI = Product::$baseProductUri . "/words/" . $this->fileName . "/appendDocument";
         //sign URI
         $signedURI = Utils::sign($strURI);
         $responseStream = Utils::processCommand($signedURI, "POST", "json", $json);
         $v_output = Utils::validateOutput($responseStream);
         if ($v_output === "") {
             //Save merged docs on server
             $folder = new Folder();
             $outputStream = $folder->getFile($sourceFolder . ($sourceFolder == '' ? '' : '/') . $this->fileName);
             $outputPath = SaasposeApp::$outputLocation . $this->fileName;
             Utils::saveFile($outputStream, $outputPath);
             return "";
         } else {
             return $v_output;
         }
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
 }
开发者ID:rvanlaak,项目名称:Saaspose.SDK-for-PHP,代码行数:39,代码来源:Document.php

示例2: replaceText

 /**
  * Replaces all instances of old text with new text in a PDF file or a particular page
  * @param string $oldText
  * @param string $newText
  */
 public function replaceText($oldText, $newText, $isRegularExpression, $pageNumber = null)
 {
     try {
         //Build JSON to post
         $fieldsArray = array('OldValue' => $oldText, 'NewValue' => $newText, 'Regex' => $isRegularExpression);
         $json = json_encode($fieldsArray);
         //Build URI to replace text
         $strURI = sprintf("%s/slides/%s%s/replaceText", Product::$baseProductUri, $this->fileName, !is_null($pageNumber) ? "/pages/" . $pageNumber : "");
         $signedURI = Utils::sign($strURI);
         $responseStream = Utils::processCommand($signedURI, "POST", "json", $json);
         $v_output = Utils::validateOutput($responseStream);
         if ($v_output === "") {
             //Save doc on server
             $folder = new Folder();
             $outputStream = $folder->getFile($this->fileName);
             $outputPath = SaasposeApp::$outputLocation . $this->fileName;
             Utils::saveFile($outputStream, $outputPath);
             return "";
         } else {
             return $v_output;
         }
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
 }
开发者ID:rvanlaak,项目名称:Saaspose.SDK-for-PHP,代码行数:30,代码来源:TextEditor.php

示例3: replaceImageUsingFile

 /**
  * Replaces Image in PDF File using Local Image Stream
  * $pageNumber
  * $imageIndex
  * $fileName
  */
 public function replaceImageUsingFile($pageNumber, $imageIndex, $fileName)
 {
     try {
         //check whether files are set or not
         if ($this->fileName == "") {
             throw new Exception("PDF file name not specified");
         }
         //build URI to replace image
         $strURI = Product::$baseProductUri . "/pdf/" . $this->fileName . "/pages/" . $pageNumber . "/images/" . $imageIndex . "?imageFile=" . $fileName;
         //sign URI
         $signedURI = Utils::sign($strURI);
         $responseStream = Utils::processCommand($signedURI, "POST", "", "");
         $v_output = Utils::validateOutput($responseStream);
         if ($v_output === "") {
             //Save PDF file on server
             $folder = new Folder();
             $outputStream = $folder->getFile($this->fileName);
             $outputPath = SaasposeApp::$outputLocation . $this->fileName;
             Utils::saveFile($outputStream, $outputPath);
             return "";
         } else {
             return $v_output;
         }
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
 }
开发者ID:rvanlaak,项目名称:Saaspose.SDK-for-PHP,代码行数:33,代码来源:Document.php

示例4: deleteAllSlides

 /**
  * Deletes all slides from a presentation
  */
 public function deleteAllSlides()
 {
     try {
         //Build URI to replace text
         $strURI = Product::$baseProductUri . "/slides/" . $this->fileName . "/slides";
         $signedURI = Utils::sign($strURI);
         $responseStream = Utils::processCommand($signedURI, "DELETE", "", "");
         $v_output = Utils::validateOutput($responseStream);
         if ($v_output === "") {
             //Save doc on server
             $folder = new Folder();
             $outputStream = $folder->getFile($this->fileName);
             $outputPath = SaasposeApp::$outputLocation . $this->fileName;
             Utils::saveFile($outputStream, $outputPath);
             return "";
         } else {
             return $v_output;
         }
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
 }
开发者ID:rvanlaak,项目名称:Saaspose.SDK-for-PHP,代码行数:25,代码来源:Document.php


注:本文中的Folder::getFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。