Inserts water mark text into the document.

@param string $fileName The name of source file.
@param string $text Watermark text.
@param string $rotationAngle Watermark rotation angle in degrees.

@return string Returns the file path.
@throws Exception
969092
public function insertWatermarkText($fileName, $text, $rotationAngle)
    {
        //check whether files are set or not
        if ($fileName == '')
            throw new Exception('File not specified');

        //Build JSON to post
        $fieldsArray = array('Text' => $text, 'RotationAngle' => $rotationAngle);
        $json = json_encode($fieldsArray);

        //build URI to insert watermark text
        $strURI = Product::$baseProductUri . '/words/' . $fileName . '/watermark/insertText';

        //sign URI
        $signedURI = Utils::sign($strURI);

        $responseStream = Utils::processCommand($signedURI, 'POST', 'json', $json);

        $v_output = Utils::validateOutput($responseStream);

        if ($v_output === '') {
            //Save docs on server
            $folder = new Folder();
            $outputStream = $folder->GetFile($fileName);
            $outputPath = AsposeApp::$outPutLocation . $fileName;
            Utils::saveFile($outputStream, $outputPath);
            return $outputPath;
        } else
            return $v_output;
    }
38117
private function getRotatedCharacter($character, $rotationAmount)
    {
        $alphabetSize = $this->getAlphabetSize();

        $positionInAlphabet = mb_stripos(self::ALPHABET, $character);

        if (false === $positionInAlphabet) {
            $rotatedCharacter = $character;
        } else {
            $newCharacterOffset = (($positionInAlphabet + $rotationAmount + $alphabetSize) % $alphabetSize)
                - $positionInAlphabet;

            $rotatedCharacter = \chr(\ord($character) + $newCharacterOffset);
        }

        return $rotatedCharacter;
    }
763571
function findFirstFileMatchingAfterNext($ns, $name, $filename) {
		$nextPtr = \strrpos($ns, '\\next\\');

		// due to the way the syntax works, the namespace before the keyword
		// next is implied from the file namespace so it's always a complete
		// namespace rather then a partial one
		$skipNamespace = substr($ns, 0, $nextPtr + 1);

		$targetNs = substr($ns, $nextPtr + 6); // strlen('\\next\\') = 6

		$skipped = false;
		foreach ($this->state['modules'] as $module) {

			if ( ! $skipped) {
				if ($module['namespace'] == $skipNamespace) {
					$skipped = true;
				}

				continue;
			}

			if ( ! $module['enabled']) {
				continue;
			}

			if (\strripos($module['namespace'], $targetNs) !== false) {
				$targetfile = $module['path'].'/src/'.$filename.'.php';
				if ($this->file_exists($targetfile)) {
					$target = $module['namespace'].$name;
					return [ $targetfile, $module['namespace'], $target ];
				}
			}
		}

		return null; // failed to match anything
	}
873216
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;
    }
722806
public function toFile($filename)
    {
        $directory = dirname($filename);

        if(empty($filename)) {
            throw new \InvalidArgumentException('No file name specified');
        }

        if (!is_dir($directory)) {
            throw new \RuntimeException(sprintf('Directory : %s does not exists!', $directory));
        }

        if (!is_writable($directory)) {
            throw new \RuntimeException(sprintf("Cannot write in directory : %s", $directory));
        }

        $result = file_put_contents($filename, $this->toString(), LOCK_EX);

        if($result === false) {
            throw new \RuntimeException(sprintf("Error writing to %s", $filename));
        }
    }
949945
public function removeWatermark($fileName)
    {
        //check whether files are set or not
        if ($fileName == '')
            throw new Exception('File not specified');

        //build URI to insert watermark image
        $strURI = Product::$baseProductUri . '/words/' . $fileName .
            '/watermark';

        //sign URI
        $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($fileName);
            $outputPath = AsposeApp::$outPutLocation . $fileName;
            Utils::saveFile($outputStream, $outputPath);
            return $outputPath;
        } else
            return $v_output;
    }
220416
public function setTextRotation($pValue = 0)
    {
        // Excel2007 value 255 => PHPExcel value -165
        if ($pValue == 255) {
            $pValue = -165;
        }

        // Set rotation
        if (($pValue >= -90 && $pValue <= 90) || $pValue == -165) {
            if ($this->isSupervisor) {
                $styleArray = $this->getStyleArray(array('rotation' => $pValue));
                $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
            } else {
                $this->textRotation = $pValue;
            }
        } else {
            throw new PHPExcel_Exception("Text rotation should be a value between -90 and 90.");
        }

        return $this;
    }
795021
private function text($text, $size, $x, $y, $color = 'black', $font = 'swiss_normal', $angle = 0)
    {
        imagettftext($this->image, $size, $angle, $x, $y, $this->colors[$color], $this->fonts[$font], $text);
    }
1257295
def OnCellTextRotation(self, event):
        """"""

        with undo.group(_("Rotation")):
            self.grid.actions.toggle_attr("angle")

        self.grid.ForceRefresh()

        self.grid.update_attribute_toolbar()

        if is_gtk():
            try:
                wx.Yield()
            except:
                pass

        event.Skip()
245246
function writeFile($filename, $data, $multicall = false)
    {
        if (!is_string($filename)) {
            throw new InvalidArgumentException('filename = ' . print_r($filename, true));
        }
        $filename = $this->secureUtf8($filename);
        if (!is_string($data)) {
            throw new InvalidArgumentException('data = ' . print_r($data, true));
        }

        $data = new Xmlrpc\Base64($data);
        return $this->execute(ucfirst(__FUNCTION__), array($filename, $data), $multicall);
    }
14108
function attribute( $attributeName )
    {
        if ( in_array( $attributeName,
                       array( 'alternative_text',
                              'original_filename',
                              'is_valid' ) ) )
        {
            return $this->attributeFromOriginal( $attributeName );
        }
        $aliasName = $attributeName;
        return $this->imageAlias( $aliasName );
    }
978425
public function rotate( File $file, $rotation ) {
		$params = [
			'rotation' => $rotation,
			'token' => $this->api->getToken(),
		];

		if ( !is_null( $file->getPageIdentifier()->getTitle() ) ) {
			$params['titles'] = $file->getPageIdentifier()->getTitle()->getText();
		} else {
			$params['pageids'] = $file->getPageIdentifier()->getId();
		}

		$result = $this->api->postRequest( new SimpleRequest( 'imagerotate', $params ) );

		// This module sometimes gives odd errors so deal with them..
		if ( array_key_exists( 'imagerotate', $result ) ) {
			$imageRotate = array_pop( $result['imagerotate'] );
			if ( array_key_exists( 'result', $imageRotate ) &&
				$imageRotate['result'] == 'Failure'
			) {
				throw new UsageException(
					'imagerotate-Failure',
					$imageRotate['errormessage'],
					$result
				);
			}
		}

		return true;
	}
294970
public function overlayWatermark(CanvasInterface $watermark, Coordinate $cooridnate = null, $mount = 100)
    {
        return $this->overlay($watermark, $mount, new Box($watermark->getDimension(), $cooridnate));
    }
372833
public function setRotationAngle($rotationAngle) {
        $this->rotationAngle = (int)$rotationAngle;
        if ($this->rotationAngle !== 90 && $this->rotationAngle !== 180 && $this->rotationAngle !== 270) {
            $this->rotationAngle = 0;
        }

        $this->rotationAngle = (360 - $this->rotationAngle) % 360;

        $this->box = null;
    }
977591
private int getRotationAngle(final ExifInterface exifInterface) {
    return JfifUtil.getAutoRotateAngleFromOrientation(
        Integer.parseInt(exifInterface.getAttribute(ExifInterface.TAG_ORIENTATION)));
  }
1214067
public static function qrcodePngWithWaterMark($text, $waterFile, $outFile = false, $width = 256, $height = 256, $margin = 1)
    {
        if (!is_file($waterFile)) {
            return false;
        }
        $sourceFile = $outFile ? $outFile : (sys_get_temp_dir() . '/' . uniqid() . '.png');
        $renderer = new Png();
        $renderer->setHeight($width);
        $renderer->setWidth($height);
        $renderer->setMargin($margin);
        $writer = new Writer($renderer);
        try {
            $writer->writeFile($text, $sourceFile);
        } catch (Exception $e) {
            echo "";
            return false;
        }

        if (!is_file($sourceFile)) {
            return false;
        }
        if(!$img = @imagecreatefromjpeg($waterFile)){
            return false;
        }
        $waterWidth = imagesx($img);
        $waterHeight = imagesy($img);

        $result = self::waterMarkImage(
            $sourceFile,
            $waterFile,
            $sourceFile,
            (int)(($width - $waterWidth) >> 1),
            (int)(($height - $waterHeight) >> 1),
            $waterWidth,
            $waterHeight
        );

        if (!$outFile) {
            header('Content-type: ' . ContentType::getFileContentType($sourceFile));
            readfile($sourceFile);
            @unlink($sourceFile);
        }
        return $result;
    }
386718
protected function writeFile(string $filename, string $content): void
    {
        try {
            $f = \fopen($filename, 'w');
            \fwrite($f, $content, \mb_strlen($content));
            \fclose($f);
        } catch (\Throwable $e) {
            throw new WriterException($e->getMessage(), $e->getCode(), $e);
        }
    }