We're sorry AsposeCloud doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.cloud

Insert a Watermark Text into Word Document in PHP Request Fails

I am using the PHP API 22.3 and using the sample code from the API documentation here:

However I keep getting the following error:

PHP Warning:  Undefined array key "Content-Type" in /workspace/aspose/vendor/aspose-cloud/aspose-words-cloud/src/Aspose/Words/ObjectSerializer.php on line 112

When I usee a different APi function it works, e.g.

    $requestDocument = "Sample.docx";
    $request = new GetSectionPageSetupOnlineRequest($requestDocument, 0, NULL, NULL, NULL);
    $result = $wordsApi->getSectionPageSetupOnline($request);    

I’m using the same docx file - so there can’t be an issue with the document.


I have tested the sample code with the latest release of Aspose.Words Cloud SDK for PHP to insert a watermark into Word document and have been unable to notice any issues. Please use the latest release, it will resolve the issue.

PHP Sample Code to Add a Watermark in Word Document



//TODO: Get your ClientId and ClientSecret at https://dashboard.aspose.cloud (free registration is required).

$wordsApi = new Aspose\Words\WordsApi($ClientId,$ClientSecret);

try {

	$remoteDataFolder = "Temp";
	$localFile = "C:/Temp/Sample.docx";
	$outputFileName = "TestWaterMark.docx";

           $requestWatermarkText = new \Aspose\Words\Model\WatermarkText(array(
            "text" => "This is the text",
            "rotation_angle" => 90.0,
        $request = new Aspose\Words\Model\Requests\InsertWatermarkTextOnlineRequest(

        $result = $wordsApi->insertWatermarkTextOnline($request);
} catch (Exception $e) {
    echo  "Something went wrong: ",  $e->getMessage(), "\n";


That fixed the problem! I should have checked that first I guess, thanks for your quick response.

1 Like