protected function setUp()
 {
     Product::$baseProductUri = $_SERVER['BASE_PRODUCT_URI'];
     AsposeApp::$appSID = $_SERVER['APP_SID'];
     AsposeApp::$appKey = $_SERVER['APP_KEY'];
     AsposeApp::$outPutLocation = getcwd() . '/Data/Output/';
 }
 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');
 }
 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');
 }
 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');
 }
 /**
  * @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;
 }
 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');
 }
 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();
 }
 /**
  * @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;
 }
 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');
 }
 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');
 }
 /**
  * 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;
 }
 /**
  * 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
     }
 }