コード例 #1
0
 protected function setUp()
 {
     Product::$baseProductUri = $_SERVER['BASE_PRODUCT_URI'];
     AsposeApp::$appSID = $_SERVER['APP_SID'];
     AsposeApp::$appKey = $_SERVER['APP_KEY'];
     AsposeApp::$outPutLocation = getcwd() . '/Data/Output/';
 }
コード例 #2
0
 protected function setUp()
 {
     Product::$baseProductUri = $_SERVER['BASE_PRODUCT_URI'];
     AsposeApp::$appSID = $_SERVER['APP_SID'];
     AsposeApp::$appKey = $_SERVER['APP_KEY'];
     AsposeApp::$outPutLocation = getcwd() . '/Data/Output/';
     $this->object = new Document('Test.docx');
 }
コード例 #3
0
 protected function setUp()
 {
     Product::$baseProductUri = $_SERVER['BASE_PRODUCT_URI'];
     AsposeApp::$appSID = $_SERVER['APP_SID'];
     AsposeApp::$appKey = $_SERVER['APP_KEY'];
     AsposeApp::$outPutLocation = getcwd() . '/Data/Output/';
     $this->texteditor = new TextEditor('Test.xlsx');
 }
コード例 #4
0
 protected function setUp()
 {
     Product::$baseProductUri = $_SERVER['BASE_PRODUCT_URI'];
     AsposeApp::$appSID = $_SERVER['APP_SID'];
     AsposeApp::$appKey = $_SERVER['APP_KEY'];
     AsposeApp::$outPutLocation = getcwd() . '/Data/Output/';
     $this->barcodereader = new BarcodeReader('barcodeQR.png');
 }
コード例 #5
0
 /**
  * @return int
  */
 public function getPageNumber()
 {
     if (null === $this->pageNumber) {
         AsposeApp::getLogger()->error('PageNumber is not set for this event.');
         throw new AsposeCloudException('PageNumber is not set for this event.');
     }
     return $this->pageNumber;
 }
コード例 #6
0
 protected function setUp()
 {
     Product::$baseProductUri = $_SERVER['BASE_PRODUCT_URI'];
     AsposeApp::$appSID = $_SERVER['APP_SID'];
     AsposeApp::$appKey = $_SERVER['APP_KEY'];
     AsposeApp::$outPutLocation = getcwd() . '/Data/Output/';
     $this->charteditor = new ChartEditor('MyBook.xlsx', 'Sheet3');
 }
コード例 #7
0
 protected function setUp()
 {
     Product::$baseProductUri = $_SERVER['BASE_PRODUCT_URI'];
     AsposeApp::$appSID = $_SERVER['APP_SID'];
     AsposeApp::$appKey = $_SERVER['APP_KEY'];
     AsposeApp::$outPutLocation = getcwd() . '/output/';
     $this->object = new Folder();
 }
コード例 #8
0
 /**
  * @return string
  */
 public function getFileName()
 {
     if ($this->fileName == '') {
         AsposeApp::getLogger()->error(Exception::MSG_NO_FILENAME);
         throw new Exception(Exception::MSG_NO_FILENAME);
     }
     return $this->fileName;
 }
コード例 #9
0
 protected function setUp()
 {
     Product::$baseProductUri = $_SERVER['BASE_PRODUCT_URI'];
     AsposeApp::$appSID = $_SERVER['APP_SID'];
     AsposeApp::$appKey = $_SERVER['APP_KEY'];
     AsposeApp::$outPutLocation = getcwd() . '/Data/Output/';
     $this->object = new Converter('MyProject.mpp');
 }
コード例 #10
0
 protected function setUp()
 {
     Product::$baseProductUri = $_SERVER['BASE_PRODUCT_URI'];
     AsposeApp::$appSID = $_SERVER['APP_SID'];
     AsposeApp::$appKey = $_SERVER['APP_KEY'];
     AsposeApp::$outPutLocation = getcwd() . '/Data/Output/';
     $this->worksheet = new Worksheet('Test.xlsx', 'Sheet1');
 }
コード例 #11
0
 /**
  * Copies a file in Aspose storage to a new destination
  *
  * @param string $fileName The name of file.
  * @param string $storageName The name of storage.
  * @return bool
  * @throws Exception
  */
 public function copyFile($fileName, $storageName = '', $newDest)
 {
     //check whether file is set or not
     if ($fileName == '' || $newDest == '') {
         AsposeApp::getLogger()->error(Exception::MSG_NO_FILENAME);
         throw new Exception(Exception::MSG_NO_FILENAME);
     }
     //build URI
     $strURI = $this->strURIFile . $fileName . '?newdest=' . $newDest;
     if ($storageName != '') {
         $strURI .= '&storage=' . $storageName;
     }
     //sign URI
     $signedURI = Utils::sign($strURI);
     $responseStream = Utils::processCommand($signedURI, 'PUT', '', '');
     $json = json_decode($responseStream);
     if ($json->Code === 200) {
         return true;
     }
     return false;
 }
コード例 #12
0
 /**
  * Get file from Aspose storage.
  *
  * @param string $fileName The name of file.
  * @param string $storageName The name of storage.
  *
  * @return array
  * @throws Exception
  */
 public function getFile($fileName, $storageName = '')
 {
     //check whether file is set or not
     if ($fileName == '') {
         AsposeApp::getLogger()->error(Exception::MSG_NO_FILENAME);
         throw new Exception(Exception::MSG_NO_FILENAME);
     }
     //build URI
     $strURI = $this->strURIFile . $fileName;
     if ($storageName != '') {
         $strURI .= '?storage=' . $storageName;
     }
     //sign URI
     $signedURI = Utils::sign($strURI);
     $responseStream = Utils::processCommand($signedURI, 'GET', '', '');
     return $responseStream;
 }
コード例 #13
0
 /**
  * Check or the result does not contain an error message. If $result is invalid it contains the error message
  * @param $result
  * @return string
  */
 public static function validateOutput($result, $saveFormat = '')
 {
     $result = (string) $result;
     $validate = array('Unknown file format.', 'Unable to read beyond the end of the stream', 'Index was out of range', 'Cannot read that as a ZipFile', 'Not a Microsoft PowerPoint 2007 presentation', 'Index was outside the bounds of the array', 'An attempt was made to move the position before the beginning of the stream', "Format '{$saveFormat}' is not supported.");
     $invalid = 0;
     foreach ($validate as $key => $value) {
         $pos = strpos($result, $value);
         if ($pos === 1 || $pos === 16) {
             $invalid = true;
         }
     }
     // Event can be used to perform extra validation on the result
     $dispatcher = AsposeApp::getEventDispatcher();
     $event = new ValidateOutputEvent($result, $invalid);
     /** @var ValidateOutputEvent $dispatchedEvent */
     $dispatchedEvent = $dispatcher->dispatch(ValidateOutputEvent::VALIDATE_OUTPUT, $event);
     // If the output is invalid it contains the error message
     if ($dispatchedEvent->isInvalid() === true) {
         return $result;
     } else {
         return '';
         // FIXME returning an empty string here is really weird
     }
 }