Take a survey

API Quick Starts (Code Examples) > Reader Extensions Service API Quick Starts > Quick Start: Retrieving credential information using the web service API

Quick Start: Retrieving credential information using the web service API
The following C# code example retrieves information about the credential that is used to apply usage-rights to a rights-enabled PDF document named UsageRightsLoan.pdf.
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.IO ; 
 
namespace RetrieveCredentialInformation
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
		try
		{
			//Create a ReaderExtensionsServiceService client object
			ReaderExtensionsServiceService  readerExClient = new ReaderExtensionsServiceService(); 
			readerExClient.Credentials = new System.Net.NetworkCredential("administrator", "password");
       
			//Create a BLOB to store a rights-enabled PDF document
			BLOB inDoc = new BLOB();
 
			//Specify a rights-enabled PDF document
			string path = "C:\\Adobe\\UsageRightsLoan.pdf";
			FileStream fs = new FileStream(path, FileMode.Open);
 
			//Get the length of the file stream 
			int len = (int)fs.Length; 
			byte[] ByteArray=new byte[len];
 
			//Populate the byte array with the contents of the FileStream object
			fs.Read(ByteArray, 0, len);
			inDoc.binaryData = ByteArray; 
 
			//Retrieve credential information
			GetUsageRightsResult usageRightsResult = readerExClient.getDocumentUsageRights(inDoc);
 
			//Get the date after which the credential is no longer valid	
			DateTime endDate = usageRightsResult.notAfter;
 
			//Get the message that is displayed in Adobe Reader when the
			//rights-enabled document is opened
			string message = usageRightsResult.message;
 
			//Get usage rights to see if the enableFormFillIn is enabled	
			UsageRights myRight = usageRightsResult.rights;
			bool ans = myRight.enabledFormFillIn ; 
 
			if (ans == true)
				Console.WriteLine("The enableFormFillIn usage right is enabled");
			else
				Console.WriteLine("The enableFormFillIn usage right is not enabled");
			}
 
			catch (Exception ee)
			{
				Console.WriteLine(ee.Message);  
			}
		}
	}
}
 
 

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/quickStarts_ReaderExtensions.14.8.html