Set a Single Document Property (PHP REST)

Skip to end of metadata
Go to start of metadata
This example allows you to set a single document property using Saaspose.Pdf REST API in your PHP applications.
We're referring to the following common methods to perform general operations:

	    $filePath = getcwd() . "\\Input\\MyFile.pdf";
	    $fileName = basename($filePath);
	    $propertyName = "Author";
	    $propertyValue = "John";
	    //set application information
	    $AppSID = "77**************";
	    $AppKey = "89***********";
	    //build URI to replace image
	    echo "Uploading pdf file... <br/>";
	    $strURIRequest = "" . "/storage/file/" . $fileName;
	    $signedURI = Sign($strURIRequest);
	    uploadFileBinary($signedURI, $filePath); 
	    echo "Pdf file has been uploaded successully <br/>";

	    echo "Setting property... </br>";
	    //build URI
	    $strURI = "" . "/pdf/" . $fileName . "/documentProperties/" . $propertyName;

	    $put_arr["Value"] = $propertyValue;
	    $json = json_encode($put_arr);

	    //sign URI
	    $signedURI = Sign($strURI);
	    $responseStream = processCommand($signedURI, "PUT", "json", $json);
	    $response_arr = json_decode($responseStream);
	    echo "Property value has been updated as " . $response_arr->DocumentProperty->Value;
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.