Files/Coverpage / CoverLatex plugins

From EPrints Documentation
Jump to: navigation, search

Coverpage / CoverLatex plugins

This is a plugin that prepends coverpages to documents. It uses a convert plugin to generate the actual pages.

The shipped implementation (CoverLatex) uses a citation XML template to generate LaTeX source, compiles that into a PDF coverpage and prepends it using pdftk.

Coverpage versions of the documents are updated and saved when documents are requested: The plugin uses the new EP_TRIGGER_DOC_URL_REWRITE trigger introduced in EPrints 3.2.1. Coverpage documents are refreshed when the corresponding document or when the associated eprint metadata changes.

The plugin also integrates into the upload workflow: If a PDF is encrypted and thus prepending a coverpage isn't possible, a warning is printed. Besides the "coverpage" metafield of the document is set to FALSE to indicate that future attempts to generate a coverpage are unnecessary.

It uses document relations (isCoverPageVersionOf, hasCoverPageVersion) to connect the original document to its coverpage version. Discovery of an appropriate conversion plugin is done via the "can_convert" method of the Convert module.


  • unpack the extension package in your archive directory (/opt/eprint3/archives/ARCHIVE_ID/)
  • edit cfg/cfg.d/
  • edit the citation file cfg/citations/eprint/coverpage_latex.xml and the corresponding phrases cfg/lang/en/phrases/coverpage.xml.
  • add a coverpage field to cfg/cfg.d/
$c->{fields}->{document} = [
                name => "coverpage",
                type => "boolean",
                input_style => 'radio',
  • run
  epadmin update_database_structure archiveid
  • add the coverpage field to cfg/workflows/eprint/default.xml:
    <component type="Documents">
      <field ref="coverpage" />
  • add the following code to validate_document() in cfg/cfg.d/
        my $cp = $session->plugin('Coverpage');
        if ($cp) {
          my $cp_switch = $document->get_value('coverpage') || '';
          if ($cp_switch ne 'FALSE') {
            my $conv_plugin = $cp->get_conversion_plugin($document);
            if ($conv_plugin) {
              my @conv_problems = $conv_plugin->validate($document);
              if (@conv_problems) {
                # pdf is encrypted
                push @problems, @conv_problems;
                $session->log("coverpage conversion problems, setting coverpage to false");
                $document->set_value('coverpage', 'FALSE');
            } else {
              # doc type not supported
          } else {
            # coverpage disabled
            my $fieldname = $session->make_element( "span", class=>"ep_problem_field:documents" );
            push @problems, $session->html_phrase('validate:coverpage_disabled',
                                                  fieldname => $fieldname);