PHP Code for Protecting or Modifying Protection of Word Documents in Cloud

Aspose's picture
Printer-friendly versionPrinter-friendly versionPDF versionPDF version

PHP developers can now easily apply or modify protection on word processing documents using Aspose Cloud SDK in PHP. When a document is protected, the user can make only limited changes, such as adding annotations, making revisions, or completing a form.


Lane Cove, NSW, Australia., June 19, 2014 - (PressReleasePoint) -

Microsoft Word password protection is a security feature used to protect documents with a user provided password. Most people use Microsoft Word but sometimes user don’t want everyone to be able to read or modify word documents. There are two options for securing Word files: either set a password to open the word document in PHP, or set a password to stop anyone from modifying the document.
 
When a document is protected, the user can make only limited changes, such as adding annotations, making revisions, or completing a form. Even if a document is protected with a password, Aspose.Words does not require the password to open, modify or remove protection from the document. When user use Aspose.Words to protect a document, user have the option of keeping the existing password or specifying a new password. If user need to make sure the document is really protected from changes, consider digitally signing the document.
 
Aspose.Words supports detecting digital signatures for DOC, OOXML and ODT documents.
 
Below are some examples which shows how to use protection feature in PHP applications
 
Protect a Word Document
 
use Aspose\Cloud\Common\AsposeApp;
use Aspose\Cloud\Common\Product;
use Aspose\Cloud\Common\Utils;
use Aspose\Cloud\Words\Document;
/**** Section 1 ****/
Product::$baseProductUri = 'http://api.aspose.com/v1.1';
AsposeApp::$appSID = "xxxxxxxxxxxxxxxxxxxxxxxx";
AsposeApp::$appKey = "xxxxxxxxxxxxxxxxxxxxxxxx";
AsposeApp::$outPutLocation = getcwd() . "/output/";
/**** End Section 1 ****/
/**** Section 2 ****/
$fileName = "Test.docx";
$password = "123456";
$protectionType = "AllowOnlyComments";
$doc = new Document($fileName);
$result = $doc->protectDocument($password, $protectionType);
/**** End Section 2 ****/
 
Unprotect a Word Document
 
use Aspose\Cloud\Common\AsposeApp;
use Aspose\Cloud\Common\Product;
use Aspose\Cloud\Common\Utils;
use Aspose\Cloud\Words\Document;
/**** Section 1 ****/
Product::$baseProductUri = 'http://api.aspose.com/v1.1';
AsposeApp::$appSID = "xxxxxxxxxxxxxxxxxxxxxxxx";
AsposeApp::$appKey = "xxxxxxxxxxxxxxxxxxxxxxxx";
AsposeApp::$outPutLocation = getcwd() . "/output/";
/**** End Section 1 ****/
/**** Section 2 ****/
$fileName = "Test.docx";
$password = "123456";
$protectionType = "NoProtection";
$doc = new Document($fileName);
$result = $doc->unprotectDocument($password, $protectionType);
/**** End Section 2 ****/
 
Modify Protection of the Word Document
 
use Aspose\Cloud\Common\AsposeApp;
use Aspose\Cloud\Common\Product;
use Aspose\Cloud\Common\Utils;
use Aspose\Cloud\Words\Document;
/**** Section 1 ****/
Product::$baseProductUri = 'http://api.aspose.com/v1.1';
AsposeApp::$appSID = "xxxxxxxxxxxxxxxxxxxxxxxx";
AsposeApp::$appKey = "xxxxxxxxxxxxxxxxxxxxxxxx";
AsposeApp::$outPutLocation = getcwd() . "/output/";
/**** End Section 1 ****/
/**** Section 2 ****/
$fileName = "Test.docx";
$oldPassword = "123456";
$newPassword = "123456789";
$protectionType = "AllowOnlyFormFields";
$doc = new Document($fileName);
$result = $doc->updateProtection($oldPassword, $newPassword, $protectionType);
/**** End Section 2 ****/
 
Overview: Aspose for Cloud
 
Aspose for Cloud is a cloud-based document generation, conversion and automation platform for developers that offer a unique suite of APIs to work with Word documents, Excel spreadsheets, PowerPoint presentations, PDFs, and email formats and protocols. It supports all features for file processing, document scanning, barcodes creation and recognition, and allows extracting text or images too. User can also work with SaaSpose APIs using REST SDKs that can be called from .NET, Java, PHP and Ruby etc.


Press Contact:
Aspose
Suite 163, 79 Longueville Road
888.277.6734
http://aspose.com
*********.*****@*s**s*.com
Email partially hidden to block spam. Please use the contact form here.
Contact Aspose
Email the contact person for this press release. Do not send spam or irrelevant message.
4 + 6 =


Copy this html code to your website/blog to embed this press release.

Comments

Post new comment

9 + 4 =