Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Apply policy to large files


Former Community Member
Hello everyone,

i´m using LC Rightsmanagement to apply policies to pdf documents. It

works fine but applying a policy to a 120 MB file takes more than four

minutes. Here is some example code

>Properties connectionProps = new Properties();






>// Create a ServiceClientFactory instance

>ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);

>// Specify the PDF document to encrypt with a password

>FileInputStream fileInputStream = new FileInputStream("c:\\TMP\\large.pdf");

>Document inDoc = new Document(fileInputStream);

>RightsManagementClient c = new RightsManagementClient(myFactory);

>Document protected = c.getDocumentManager().applyPolicy(inDoc, "large", "Policy Set", "Policy", "Domain", "user");

>File myFile = new File("c:\\TMP\\large_protected.pdf");


The last statement "protected.copyToFile(myFile)" takes most time (up

to 4 minutes). Watching the network shows a lot of traffic, so i think

the protected content is streamed via network.

If i use acrobat pro to apply the policy it only needs a few seconds

till the jobs done, so i think that there must be a much faster way to

apply a policy to a document.

Does anyone know about this problem?


5 Replies


Level 10
How much memory does you JVM has?



Level 10
Does it take four minutes do execute the applyPolicy line or to execute the whole code?

I'm wondering how long it takes to execute the

new FileInputStream("c:\\TMP\\large.pdf");

or the new Document(fileInputStream);



Former Community Member
It takes about 4 1/2 Minutes to execute the whole code.

>.applyPolicy(inDoc, "large", "Policy Set", "Policy", "Domain", "user");

returns after 20 seonds.

The execution of "protected.copyToFile(myFile);" is the one with the highest costs. If i watch the file in explorer i can see it grow with a rate of ~ 400KB/second. Of course our network is much more performant and i would like to instruct lc server to send 4000KB/sec [or more :-)]. adobe livedocs pages (http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/javadoc/) tell me to set system properties to tune performance. But


doesn´t have any effect.


Level 10
I did a test on my local server on a 130 meg file.

It takes 4 seconds to apply the policy and 22-24 seconds to write it to the file system and apply the policy.

What kind of machine (specification) are you using?



Former Community Member
LC runs in a jboss instance. Jboss itselfs runs on a virtual machine. i don't know if it is a windows or linux host. I did some profiling myself.