Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Apply policy to large files

Avatar

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();

>connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT,"jnp://localhost:1099");

>connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_EJB_PROTOCOL);

>connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE,"JBoss");

>connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME,"administrator");

>connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD,"password");



>// 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");



>protected.copyToFile(myFile);



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?



thx

rijn
5 Replies

Avatar

Level 10
How much memory does you JVM has?



Jasmin

Avatar

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);



Jasmin

Avatar

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

>System.setProperty("com.adobe.idp.defaultDocumentMaxInlineSize",String.valueOf(1024*1024));



doesn´t have any effect.

Avatar

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?



Jasmin

Avatar

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.