Expand my Community achievements bar.

Microsoft word documents and removing policy.

Avatar

Level 2

Can DocumentManger class can be used to remove security policy from secured Microsfot word docuemnts.

Or protable protection library is the only way to deal with Microsoft word documents?

I want my application to remove the strip off all security information from the document and re insert the same again at a later point.

is portable protection library is the only way to go here.

3 Replies

Avatar

Former Community Member

It looks like you can, the following is from the JavaDocs (avaliable here http://help.adobe.com/en_US/livecycle/9.0/programLC/javadoc/index.html )

removeSecurity

Document removeSecurity(Document inPDFDoc)
                        throws SDKException
Removes the security from a policy-protected document provided that a super administrator   is used in connection settings.   If not, then the policy used to secure a document must contain the SWITCH_POLICY permission in order for this method to remove the security from a PDF document.  Also, the user specified in the LiveCycle ES2 connection settings must also have that permission.   Otherwise, an exception is thrown.   A user cannot open an unsecured PDF document until the returned document   is written to a PDF or DOC file.

To see this method used in a code example that removes a policy from a PDF document,  see the Removing a policy from a PDF document using the Java API quick start   in Programming with LiveCycle ES2.

To see this method used in a code example that removes a policy from a Word document,  see the Removing a policy from a Word document using the Java API quick start   in Programming with LiveCycle ES2.


Parameters:
inPDFDoc - A Document object that represents the policy-protected document.
Returns:
A Document object that represents an unsecured document.


Regards
Steve

Avatar

Level 2

Thanks Steve for pointing out to API.

I am getting exception as below for java client code snippet while inspecting document which is secured using MS Word 2007.

Properties connectionProps = new Properties();
connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "jnp://vvcon-qa-1.ptcnet.ptc.com: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, "administrator");

           
ServiceClientFactory factory = ServiceClientFactory.createInstance(connectionProps);
RightsManagementClient rightsClient = new RightsManagementClient(factory);

//Reference a policy-protected Word document from which to remove a policy
FileInputStream is = new FileInputStream(args[0]);
Document inPDF = new Document(is);

//Create a Document Manager object
DocumentManager  documentManager = rightsClient.getDocumentManager();
RMInspectResult lic = documentManager.inspectDocument(inPDF);

Exception I am getting

com.adobe.edc.sdk.SDKException: Error while looking up RM Header in the document -- Invalid argument(error code bin: 1281, hex: 0x501)
    at com.adobe.livecycle.rightsmanagement.RightsManagementService.throwSDKException(RightsManagementService.java:958)
    at com.adobe.livecycle.rightsmanagement.RightsManagementService.getLicenseID(RightsManagementService.java:794)
    at com.adobe.livecycle.rightsmanagement.RightsManagementService.inspectDocument(RightsManagementService.java:2260)

Event if I try with user who can access document after connecting to LiveCycle ES2 from Microsoft Word 2007 I am getting same exception.

I can acess document from MS Word after I have secured it using all users who have right permission for document but from java client I am not able to do that. Looks like RMS information is not embedded properly in my document.

jars included in my classpath are

adobe-rightsmanagement-client.jar,namespace.jar,jaxb-api.jar,jaxb-impl.jar,jaxb-libs.jar,jaxb-xjc.jar,relaxngDatatype.jar,adobe-livecycle-client.jar,adobe-usermanager-client.jar,jbossall-client.jar

My client is running on Windows XP 32 bit with Office 2007.

Server is installed on Windows server 2008 R2 64 bit and deplyoed using JBoss.

Regards,

Sharang

Avatar

Level 2

One more intresting fact here is my java client can protect document and unprotect same document.

However document which is protected by Microsoft Rights Management extension plugin cannot be unprotected by my java client.

Regards,

Sharang