Jump to content
Wiki Home
EPrints Home
Bazaar
Files
Main menu
Main menu
move to sidebar
hide
Navigation
Front Page
EPrints 3 Manual
EPrints Training Course
EPrints Glossary
Installing EPrints
How-to Configure EPrints
EPrints 3.2+ API
EPrints 3 Reference
EPrints Plugins
Wiki
All categories
Recent changes
Main Page
Help
EPrints Documentation
Search
Search
Appearance
Log in
Request account
Personal tools
Log in
Request account
Pages for logged out editors
learn more
Contributions
Talk
Editing
API:EPrints/Plugin/Convert
Page
Discussion
British English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
<!-- Pod2Wiki=_preamble_ This page has been automatically generated from the EPrints 3.2 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost. -->{{API}}{{Pod2Wiki}}{{API:Source|file=perl_lib/EPrints/Plugin/Convert.pm|package_name=EPrints::Plugin::Convert}}[[Category:API|CONVERT]][[Category:API:EPrints/Plugin|CONVERT]][[Category:API:EPrints/Plugin/Convert|CONVERT]]<div><!-- Edit below this comment --> <!-- Pod2Wiki=_private_ --><!-- Pod2Wiki=head_name --> ==NAME== EPrints::Plugin::Convert - Convert EPrints::DataObj::Document into different formats <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_description --> ==DESCRIPTION== This plugin and its dependents allow EPrints to convert documents from one format into another format. Convert plugins are also used by the full-text indexer to extract plain-text from documents. Convert plugins may provide conversions from any number of formats to any number of other formats (or not even 'formats' per-se e.g. unpacking/packing archives). A single plugin may represent a particular software package (e.g. ImageMagick) or a common goal (e.g. textifying documents for indexing). Using the root Convert plugin it is possible to query all loaded conversion plugins for available conversions from a given [[API:EPrints/DataObj/Document|EPrints::DataObj::Document]]. To allow for simpler local configuration Convert plugins should use SystemSettings to store the location of external programs. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_synopsis --> ==SYNOPSIS== <source lang="perl">my $root = $repo->plugin( 'Convert' ); # Get the the available conversions for all plugins my %available = $root->can_convert( $document ); # Get a conversion scheme for text/plain my $txt_tool = $available{'text/plain'}; # Use the plugin to convert the document to text/plain my $plugin = $txt_tool->{'plugin'}; $plugin->convert( $eprint, $document, 'text/plain' );</source> <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_methods --> ==METHODS== <!-- Pod2Wiki=head_new --> ===new=== <source lang="perl">new OPTIONS </source> Create a new plugin object using OPTIONS (should only be called by [[API:EPrints/Session|EPrints::Session]]). <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_render_name --> ===render_name=== <source lang="perl">$xhtml = $plugin->render_name </source> Return the name of this plugin as a chunk of XHTML. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_is_visible --> ===is_visible=== <source lang="perl">$plugin->is_visible( $level ) </source> Returns whether this plugin is visible at level (currently 'all' or ''). <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_can_convert --> ===can_convert=== <source lang="perl">%types = $p->can_convert( $doc, [$type], [%params] ) </source> Returns a hash of types that this plugin can convert the document $doc to. The key is the type. The value is a hash ref containing: * plugin : The object that can do the conversion. * encoding : The encoding this conversion generates (e.g. 'utf-8'). * phraseid : A unique phrase id for this conversion. * preference : A value between 0 and 1 representing the 'quality' or confidence in this conversion. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_export --> ===export=== <source lang="perl">@filelist = $p->export( $dir, $doc, $type ) </source> Convert $doc to $type and export it to $dir. Returns a list of file names that resulted from the conversion. The main file (if there is one) is the first file name returned. Returns empty list on failure. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_convert --> ===convert=== <source lang="perl">$doc = $p->convert( $eprint, $doc, $type [, $epdata ] ) </source> Convert $doc to format $type (as returned by can_convert). Stores the resulting $doc in $eprint, and returns the new document or undef on failure. Optionally initialise the new document with $epdata. Specifying 'files' in $epdata will cause the converted file content to be discarded. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_copyright --> ==COPYRIGHT== Copyright 2000-2011 University of Southampton. This file is part of EPrints http://www.eprints.org/. EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. EPrints 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with EPrints. If not, see http://www.gnu.org/licenses/. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=_postamble_ --> <!-- Edit below this comment -->
Summary:
Please note that all contributions to EPrints Documentation may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
EPrints Documentation:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:API
(
edit
)
Template:API:Source
(
edit
)
Template:Pod2Wiki
(
edit
)
Template:RefLinks
(
edit
)