aspose file tools*
The moose likes Blatant Advertising and the fly likes Watermark Text Addition to Word Documents in .NET Applications Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Other » Blatant Advertising
Bookmark "Watermark Text Addition to Word Documents in .NET Applications" Watch "Watermark Text Addition to Word Documents in .NET Applications" New topic
Author

Watermark Text Addition to Word Documents in .NET Applications

sher azam
Ranch Hand

Joined: Jul 04, 2012
Posts: 60
This technical tip allows developers to add watermark text to a Word document using Saaspose.Words REST API in your .NET applications. Some important steps for performing this task are to build URI to add watermark text and then serialize the JSON request content. After that, parse the json string to JObject. Developers can use the WatermarkText class and BaseResponse class for adding Watermark text.

Sample Code for Adding Watermark Text to a Word Document

//build URI to add watermark text
string strURI = "http://api.saaspose.com/v1.0/words/input.docx/insertWatermarkText";
string signedURI = Sign(strURI);
//serialize the JSON request content
WatermarkText watermark = new WatermarkText();
watermark.Text = "Watermark Text Here";
watermark.RotationAngle = 45.0;
string strJSON = JsonConvert.SerializeObject(watermark);
Stream responseStream = ProcessCommand(signedURI, "POST", strJSON);
StreamReader reader = new StreamReader(responseStream);
string strResponse = reader.ReadToEnd();
//Parse the json string to JObject
JObject pJSON = JObject.Parse(strResponse);
BaseResponse baseResponse = JsonConvert.DeserializeObject<BaseResponse>(pJSON.ToString());
if (baseResponse.Code == "200" && baseResponse.Status == "OK")
Console.WriteLine("Watermark text has been added successfully");

//Here is the WatermarkText class
public class WatermarkText
{
public string Text { get; set; }
public double RotationAngle { get; set; }
}


//Here is the BaseResponse class
public class BaseResponse
{
public BaseResponse() { }
public string Code { get; set; }
public string Status { get; set; }
}

More about Saaspose.Words

- Homepage of Saaspose.Words
- More Technical Tips by Saaspose.Words
- Ask technical questions/queries from Saaspose Support Team

Contact Information
Aspose Pty Ltd, Suite 163,
79 Longueville Road
Lane Cove, NSW, 2066
Australia
Saaspose - Your File Format Experts 2.0
sales@aspose.com
Phone: 1.214.329.1520
Fax: 866.810.9465
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Watermark Text Addition to Word Documents in .NET Applications
 
Similar Threads
Read & Recognize Barcode from External Image URL Using REST API
November 2012 Edition of Saaspose.Newsletter is Out Now
Extract Images from Word, Excel, PowerPoint & PDF Files Using REST APIs
Create Word Documents from XML Template with Original Formatting in Cloud
Convert Word to PDF with Same Data, Formatting & Objects in the Cloud