Page MenuHomec4science

websubmit-file-stamper.webdoc
No OneTemporary

File Metadata

Created
Tue, Aug 6, 21:52

websubmit-file-stamper.webdoc

## -*- mode: html; coding: utf-8; -*-
## This file is part of Invenio.
## Copyright (C) 2010, 2011 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## Invenio is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Invenio; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
<!-- WebDoc-Page-Title: Stamping fulltextes -->
<!-- WebDoc-Page-Navtrail: <a class="navtrail" href="<CFG_SITE_URL>/help/hacking">Hacking Invenio</a> &gt; <a class="navtrail" href="websubmit-internals">WebSubmit Internals</a> -->
<p>The WebSubmit File Stamper library (<tt>websubmit_file_stamper.py</tt>) let you stamps your PDFs.</p>
<h2>Python API</h2>
<protect><pre>
def stamp_file(options):
"""The driver for the stamping process. This is effectively the function
that is responsible for coordinating the stamping of a file.
@param options: (dictionary) - a dictionary of options that are required
by the function in order to carry out the stamping process.
The dictionary must have the following structure:
+ latex-template: (string) - the path to the LaTeX template to be
used for the creation of the stamp itself;
+ latex-template-var: (dictionary) - This dictionary contains
variables that should be sought in the LaTeX template file, and
the values that should be substituted in their place. E.g.:
{ "TITLE" : "An Introduction to Invenio" }
+ input-file: (string) - the path to the input file (i.e. that
which is to be stamped;
+ output-file: (string) - the name of the stamped file that should
be created by the program. This is optional - if not provided,
a default name will be applied to a file instead;
+ stamp: (string) - the type of stamp that is to be applied to the
input file. It must take one of 3 values:
- "first": Stamp only the first page of the document;
- "all": Apply the stamp to all pages of the document;
- "coverpage": Add a "cover page" to the document;
+ layer: (string) - the position of the stamp in the layers of the
file. Is one of the following values:
- "background": stamp applied to the background layer;
- "foreground": stamp applied to the foreground layer;
+ verbosity: (integer) - the verbosity level under which the program
is to run;
+ skip-metadata: (boolean) - whether to skip copying the metadata
or not;
So, an example of the returned dictionary would be something like:
{ 'latex-template' : "demo-stamp-left.tex",
'latex-template-var' : { "REPORTNUMBER" : "TEST-2008-001",
"DATE" : "15/02/2008",
},
'input-file' : "test-doc.pdf",
'output-file' : "",
'stamp' : "first",
'layer' : "background",
'verbosity' : 0,
'skip-metadata' : False,
}
@return: (tuple) - consisting of two strings:
1. the path to the working directory in which all stamping-related
files are stored;
2. The name of the "stamped" file;
@Exceptions raised: (InvenioWebSubmitFileStamperError) exceptions may
be raised or propagated by this function when the stamping process
fails for one reason or another.
"""
</pre></protect>
<p>See <a href="http://invenio-software.org/code-browser/invenio.websubmit_file_stamper-module.html">websubmit_file_stamper API</a> for a complete API description.</p>

Event Timeline