Package com.logicaldoc.core.conversion
Class FormatConverterManager
java.lang.Object
com.logicaldoc.core.conversion.FormatConverterManager
Manager class used to handle format converters. For each couple
 inFormat-outFormat you may have different possible converters, they are taken
 by the FormatConverter extension point. The actual converter uses is
 the one pointed by the context property names converter.inExt-outExt.
- Since:
- 7.1.3
- Author:
- Marco Meschieri - LogicalDOC
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionconvert(Document document, String fileVersion, String format, DocumentHistory transaction) Converts a document into another format and saves the resulting file in the same foldervoidConverts a file into a different formatvoidconvertToFile(Document document, String fileVersion, File out, DocumentHistory transaction) Converts a document and writes the content of the conversion into a file.voidconvertToPdf(Document document, String sid) Shortcut for convertToPdf(document, null, transaction)voidconvertToPdf(Document document, String fileVersion, String sid) Creates the pdf for the specified document and file version (suffix PDF_CONVERSION_SUFFIX).Returns the list of possible convertersgetAllOutputFormats(String inFileName) Returns all the possible output formats for the given input formatgetAvailableConverters(String inFileName, String outFileName) Returns the list of possible converters for a given in and out formatReturns all the possible input formatsgetConverter(String inFileName, String outFileName) Loads the proper converter for the passed file names.getEnabledOutputFormats(String srcFilename) Returns the available output formats for the given input formatbyte[]getPdfContent(Document document, String fileVersion, String sid) Retrieves the content of the Pdf conversion.voidinit()Initializes the converters mapvoidwritePdfToFile(Document document, String fileVersion, File out, String sid) Write the content of the Pdf conversion into a file.
- 
Field Details- 
PDF_CONVERSION_SUFFIX- See Also:
 
 
- 
- 
Constructor Details- 
FormatConverterManagerpublic FormatConverterManager()
 
- 
- 
Method Details- 
getPdfContentRetrieves the content of the Pdf conversion. If the Pdf conversion is not available in the store, it is created.- Parameters:
- document- The document to be processed
- fileVersion- The file version(optional)
- sid- (optional)
- Returns:
- The content of the PDF as bytes
- Throws:
- IOException- If something went wrong
 
- 
writePdfToFilepublic void writePdfToFile(Document document, String fileVersion, File out, String sid) throws IOException Write the content of the Pdf conversion into a file. If the Pdf conversion is not available in the store, it is created.- Parameters:
- document- The document to be processed
- fileVersion- The file version(optional)
- out- the output file
- sid- (optional)
- Throws:
- IOException- If something went wrong
 
- 
convertToPdfCreates the pdf for the specified document and file version (suffix PDF_CONVERSION_SUFFIX). If the Pdf conversion already exists it, nothing happens.- Parameters:
- document- The document to be processed
- fileVersion- The file version(optional)
- sid- (optional)
- Throws:
- IOException- If something went wrong
 
- 
convertToPdfShortcut for convertToPdf(document, null, transaction)- Parameters:
- document- The document to be processed
- sid- identifier of the session
- Throws:
- IOException- If something went wrong
 
- 
convertpublic Document convert(Document document, String fileVersion, String format, DocumentHistory transaction) throws IOException, PersistenceException Converts a document into another format and saves the resulting file in the same folder- Parameters:
- document- The document to be processed
- fileVersion- The file version(optional)
- format- the extension used to define the output format
- transaction- details of the current session
- Returns:
- the document that represents the conversion
- Throws:
- IOException- I/O error
- PersistenceException- Error in the database
 
- 
convertToFilepublic void convertToFile(Document document, String fileVersion, File out, DocumentHistory transaction) throws IOException Converts a document and writes the content of the conversion into a file.- Parameters:
- document- The document to be processed
- fileVersion- The file version(optional)
- out- the target file, the extension of this filename is used to detect the output format
- transaction- informations about the session
- Throws:
- IOException- if an error happens during the conversion
 
- 
convertFilepublic void convertFile(File in, String inFilename, File out, String outFormat, String sid) throws IOException Converts a file into a different format- Parameters:
- in- input file (the filename extension determines the source format, in case you do not use inFilename)
- inFilename- file name of the input
- out- output file (if outFormat is null, the filename extension determines the output format)
- outFormat- extension of the output
- sid- session ID (optional)
- Throws:
- IOException- if an error happens during the conversion
 
- 
getEnabledOutputFormatsReturns the available output formats for the given input format- Parameters:
- srcFilename- name of the file
- Returns:
- identifiers of the possible output extensions
 
- 
getAllOutputFormatsReturns all the possible output formats for the given input format- Parameters:
- inFileName- name of the file to convert
- Returns:
- list of possible output formats
 
- 
getAvailableInputFormatsReturns all the possible input formats- Returns:
- the collection of all available input formats
 
- 
getAvailableConvertersReturns the list of possible converters for a given in and out format- Parameters:
- inFileName- input file name
- outFileName- conversion file name
- Returns:
- the collection of all installed format converters
 
- 
getAllConvertersReturns the list of possible converters- Returns:
- the collection of all installed format converters
 
- 
getConverterLoads the proper converter for the passed file names. The right converter used is defined in the configuration parameter converter.composeKey()- Parameters:
- inFileName- file name of the input content
- outFileName- file name of the conversion
- Returns:
- The right format converter
 
- 
initpublic void init()Initializes the converters map
- 
getConverters
 
-