PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Old November 28th, 2012, 10:07 PM
saaspose saaspose is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 20 saaspose User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 40 m 41 sec
Reputation Power: 0
Add Watermark Text to a Word Document in the Cloud

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

Code:
//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; }
	    }

Reply With Quote
Old November 29th, 2012, 08:26 AM
MatthewJ MatthewJ is offline
Contributing User
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: May 2007
Location: Davenport, Iowa
Posts: 1,021 MatthewJ User rank is Lance Corporal (50 - 100 Reputation Level)MatthewJ User rank is Lance Corporal (50 - 100 Reputation Level)MatthewJ User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 6 Days 12 h 13 m 18 sec
Reputation Power: 8
Spamming forums with sales posts will not make you friends

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Add Watermark Text to a Word Document in the Cloud


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap