Applying DRM

This chapter describes how to apply DRM(Digital rights management) when you create PDF and other files. Because there are many DRM technologies, ManualWorks does not support any specific DRM method. You must apply DRM yourself by using a simple API.

Writing a Java Class

Write a Java class like the following.

package com.threerabbitz.drm;

import java.io.File;
import java.util.Map;

public class SampleDrmRunner {

    public File run(File before, Map<String, String> option) {
        return null;
    }

}

1You can choose any package name.

6You can choose any class name.

8Implement a run method that takes java.io.File and java.util.Map as parameters and returns java.io.File. ManualWorks moves the file that the method returns after applying DRM to the location that ManualWorks manages.

9Return the file with DRM applied. If you do not return a file, DRM is not applied.

The java.util.Map parameter of the run method contains the following information.

Map parameter information

Key

Description

Example

reference

Document ID(the chapter ID for chapter PDFs, the tag ID for files created from tags)

9f7ea2eca789a525

type

File type

PDF, EPUB, WORD, HTML

extension

File extension(word, not docx, for MS Word files)

pdf, epub, word, zip

Packaging a jar File

Follow these steps.

  1. Compile the Java class and package it as a jar file.

When you compile the Java code, use the same Java version that ManualWorks uses or a lower version.

  1. Copy the packaged jar file to the 3RABBITZ_HOME/web/WEB-INF/lib directory.

    • Copy the related libraries to the same directory as well.

  2. Restart ManualWorks.

Setting the DRM Class in the Console

In the Console, set the DRM class with the following command.

set-drm -class com.threerabbitz.drm.SampleDrmRunner

Set the class parameter to the fully qualified name of the class you wrote. You cannot set a class that does not have a run(File, Map) method.

In the Console, check the DRM class with the following command.

get-drm

To clear the DRM class, run the following command in the Console.

clear-drm