Expand my Community achievements bar.

ReaderExtensionService:applyUsageRights returns null attachment, Language:C#

Avatar

Former Community Member
I'm trying to call the ReaderExtensionService using C# console application. The code is



[STAThread]

static void Main(string[] args)

{

ReaderExtension.ReaderExtensionsServiceService reader = new Acro_Comments.ReaderExtension.ReaderExtensionsServiceService();

reader.Credentials = new System.Net.NetworkCredential("administrator", "password");

FileStream pdfFile = new FileStream("D:\\PDF\\XMP-Embedding.pdf", FileMode.Open);



byte[] pdfContent = new byte[pdfFile.Length];

pdfFile.Read(pdfContent, 0, (int)pdfFile.Length);



ReaderExtension.BLOB pdfBytes = new Acro_Comments.ReaderExtension.BLOB();



pdfBytes.binaryData = pdfContent;



ReaderExtension.ReaderExtensionsOptionSpec spec = new Acro_Comments.ReaderExtension.ReaderExtensionsOptionSpec();

spec.usageRights = new Acro_Comments.ReaderExtension.UsageRights();

spec.message = "Add Comments";

spec.usageRights.enabledComments = true;

// spec.usageRights.enabledCommentsOnline =true;

pdfFile.Close();





try

{

spec.modeFinal = true;



ReaderExtension.BLOB pdfWrite = reader.applyUsageRights(pdfBytes, "SHARED_REVIEW", "fcVdvQQiGU", spec);



FileStream writePDF = new FileStream("D:\\PDF\\Return.pdf", FileMode.CreateNew);

writePDF.Write(pdfWrite.binaryData, 0, (int)pdfContent.Length);

writePDF.Close();

}

catch (Exception ex)

{

Console.WriteLine(ex.Message);



File.Delete("D:\\PDF\\Return.pdf");

}

Console.Read();



}



But the applyUsageRights API returns null for the Blob attachment,binaryData. Please help me?



I have the Adobe LiveCycle 8.0 ES suite installed. I have used Express Mode and configured the ReaderExtesnion service no other service are configured.



The Os:Windows 2003 server

.NEt Framework:2.0

IDE:VS2005

I have Adobe Acrobat Reader 8.0 installed....



Regards,

Debasish Pramanik

http://debasishpramanik.wordpress.com
1 Reply

Avatar

Former Community Member
I figured it out, we need to put a suffix to the URL before invoking the applyUsageRights



reader.Url = reader.Url + "?blob=base64";



This url is good help

http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/wwhelp/wwhimpl/common/html/wwhelp....



but the rights not getting enabled on the PDF..I will keep you guys updated...