Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to restrict pdf printing on a condition

Avatar

Level 1

Hello,

We generate the pdf and distribute it to the user immediately. I've a business requirement to allow the user to print the pdf a maximum of 3 times. I was able to add the javascript to the pdf to make a webservice call that would keep a track of prints(by getting the pdf blessed by the livecycle readerextensions). Now, I've two questions :

1.How can I disable printing on the pdf document when max number of reprints is reached?

2.The pdf throws security warning when it makes the webservice call. Is there anyway to supress it?

Thanks in advance for the responses.

Feroz.

1 Accepted Solution

Avatar

Correct answer by
Employee

This can be achieved by protecting the documents via  Rights Management. Please see sample at http://help.adobe.com/en_US/livecycle/9.0/samples/SDKRightsManagementExternalAuthorization.html to restrict Print to only once.

View solution in original post

2 Replies

Avatar

Correct answer by
Employee

This can be achieved by protecting the documents via  Rights Management. Please see sample at http://help.adobe.com/en_US/livecycle/9.0/samples/SDKRightsManagementExternalAuthorization.html to restrict Print to only once.

Avatar

Level 1

Thanks Neerava. I tried compiling the project in the link you provided and I'm getting the following error:

build-project:

     [copy] Copying 1 file to C:\ExternalAuthorization 2\output

     [echo] ExternalAuthorization: C:\ExternalAuthorization 2\build.xml

    [javac] C:\ExternalAuthorization 2\build.xml:46: warning: 'includeantruntime' was not set, defaulting to build.syscl

asspath=last; set to false for repeatable builds

    [javac] Compiling 2 source files to C:\ExternalAuthorization 2\output

    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.5

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\BootstrapImpl.java:3: error: package

com.adobe.idp.dsc.component does not exist

    [javac] import com.adobe.idp.dsc.component.Bootstrap;

    [javac]                                   ^

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\BootstrapImpl.java:4: error: package

com.adobe.idp.dsc.component does not exist

    [javac] import com.adobe.idp.dsc.component.BootstrapContext;

    [javac]                                   ^

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\BootstrapImpl.java:6: error: cannot

find symbol

    [javac] public class BootstrapImpl implements Bootstrap {

    [javac]                                       ^

    [javac]   symbol: class Bootstrap

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\BootstrapImpl.java:8: error: cannot

find symbol

    [javac]     private BootstrapContext m_ctx;

    [javac]             ^

    [javac]   symbol:   class BootstrapContext

    [javac]   location: class BootstrapImpl

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\BootstrapImpl.java:10: error: cannot

find symbol

    [javac]     public void setBootstrapContext(BootstrapContext aCtx) {

    [javac]                                     ^

    [javac]   symbol:   class BootstrapContext

    [javac]   location: class BootstrapImpl

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:3: error:

package com.adobe.edc.server.spi.authorization does not exist

    [javac] import com.adobe.edc.server.spi.authorization.*;

    [javac] ^

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:4: error:

package com.adobe.idp does not exist

    [javac] import com.adobe.idp.Context;

    [javac]                     ^

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:5: error:

package com.adobe.idp.dsc.clientsdk does not exist

    [javac] import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;

    [javac]                                   ^

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:6: error:

package com.adobe.livecycle.rightsmanagement.client does not exist

    [javac] import com.adobe.livecycle.rightsmanagement.client.RightsManagementClient;

    [javac]                                                   ^

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:7: error:

package com.adobe.livecycle.rightsmanagement.client does not exist

    [javac] import com.adobe.livecycle.rightsmanagement.client.EventManager;

    [javac]                                                   ^

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:8: error:

package com.adobe.livecycle.rightsmanagement.client.infomodel does not exist

    [javac] import com.adobe.livecycle.rightsmanagement.client.infomodel.Event;

    [javac]                                                             ^

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:9: error:

package com.adobe.livecycle.rightsmanagement.client.infomodel does not exist

    [javac] import com.adobe.livecycle.rightsmanagement.client.infomodel.EventSearchFilter;

    [javac]                                                             ^

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:19: error

: cannot find symbol

    [javac] public class PrintServiceSPISample implements ExternalAuthorizer

    [javac]                                               ^

    [javac]   symbol: class ExternalAuthorizer

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:21: error

: cannot find symbol

    [javac]     private EventManager           _evt_manager = null;

    [javac]             ^

    [javac]   symbol:   class EventManager

    [javac]   location: class PrintServiceSPISample

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:22: error

: cannot find symbol

    [javac]     private ServiceClientFactory   _sc_factory  = null;

    [javac]             ^

    [javac]   symbol:   class ServiceClientFactory

    [javac]   location: class PrintServiceSPISample

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:23: error

: cannot find symbol

    [javac]     private RightsManagementClient _rm_client   = null;

    [javac]             ^

    [javac]   symbol:   class RightsManagementClient

    [javac]   location: class PrintServiceSPISample

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:25: error

: cannot find symbol

    [javac]     public ExternalAuthPropertyDTO[] getProviderProperties()

    [javac]            ^

    [javac]   symbol:   class ExternalAuthPropertyDTO

    [javac]   location: class PrintServiceSPISample

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:30: error

: cannot find symbol

    [javac]     public ExternalAuthResultDTO evaluate( ExternalAuthDTO auth_info )

    [javac]                                            ^

    [javac]   symbol:   class ExternalAuthDTO

    [javac]   location: class PrintServiceSPISample

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:30: error

: cannot find symbol

    [javac]     public ExternalAuthResultDTO evaluate( ExternalAuthDTO auth_info )

    [javac]            ^

    [javac]   symbol:   class ExternalAuthResultDTO

    [javac]   location: class PrintServiceSPISample

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:27: error

: cannot find symbol

    [javac]     return new ExternalAuthPropertyDTO[0];

    [javac]                ^

    [javac]   symbol:   class ExternalAuthPropertyDTO

    [javac]   location: class PrintServiceSPISample

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:32: error

: cannot find symbol

    [javac]     ExternalAuthResultDTO ret_val = new ExternalAuthResultDTO();

    [javac]     ^

    [javac]   symbol:   class ExternalAuthResultDTO

    [javac]   location: class PrintServiceSPISample

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:32: error

: cannot find symbol

    [javac]     ExternalAuthResultDTO ret_val = new ExternalAuthResultDTO();

    [javac]                                         ^

    [javac]   symbol:   class ExternalAuthResultDTO

    [javac]   location: class PrintServiceSPISample

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:54: error

: cannot find symbol

    [javac]         Context context = (Context)auth_info.getContext();

    [javac]         ^

    [javac]   symbol:   class Context

    [javac]   location: class PrintServiceSPISample

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:54: error

: cannot find symbol

    [javac]         Context context = (Context)auth_info.getContext();

    [javac]                            ^

    [javac]   symbol:   class Context

    [javac]   location: class PrintServiceSPISample

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:102: erro

r: cannot find symbol

    [javac]         EventSearchFilter print_search = new EventSearchFilter();

    [javac]         ^

    [javac]   symbol:   class EventSearchFilter

    [javac]   location: class PrintServiceSPISample

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:102: erro

r: cannot find symbol

    [javac]         EventSearchFilter print_search = new EventSearchFilter();

    [javac]                                              ^

    [javac]   symbol:   class EventSearchFilter

    [javac]   location: class PrintServiceSPISample

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:118: erro

r: cannot find symbol

    [javac]         Event[] out_events = _evt_manager.searchForEvents( print_search, 10 );

    [javac]         ^

    [javac]   symbol:   class Event

    [javac]   location: class PrintServiceSPISample

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:148: erro

r: cannot find symbol

    [javac]         _sc_factory  = ServiceClientFactory.createInstance();

    [javac]                        ^

    [javac]   symbol:   variable ServiceClientFactory

    [javac]   location: class PrintServiceSPISample

    [javac] C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java:149: erro

r: cannot find symbol

    [javac]         _rm_client   = new RightsManagementClient( _sc_factory );

    [javac]                            ^

    [javac]   symbol:   class RightsManagementClient

    [javac]   location: class PrintServiceSPISample

    [javac] Note: C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java use

s or overrides a deprecated API.

    [javac] Note: Recompile with -Xlint:deprecation for details.

    [javac] Note: C:\ExternalAuthorization 2\com\adobe\livecycle\samples\rightsmanagement\PrintServiceSPISample.java use

s unchecked or unsafe operations.

    [javac] Note: Recompile with -Xlint:unchecked for details.

    [javac] 29 errors

    [javac] 1 warning

BUILD FAILED