Converter
Leave feedback
On this page
Inheritance: java.lang.Object
All Implemented Interfaces: java.io.Closeable
public class Converter implements Closeable
Represents main class that controls document conversion process.
public Converter()
Initializes new instance of class for fluent conversion setup. Sample fluent conversion usage: var converter = new Converter(); converter
.Load("")
.ConvertTo("")
.Convert(); converter
.WithSettings(() => new ConverterSettings())
.Load("").WithOptions(new PdfLoadOptions())
.ConvertTo("").WithOptions(new PdfConvertOptions())
.OnConversionCompleted(convertedDocumentStream => { })
.Convert(); converter
.Load("").WithOptions(new PdfLoadOptions())
.ConvertByPageTo((number => new FileStream("", FileMode.Create))).WithOptions(new PdfConvertOptions())
.OnConversionCompleted((number, stream) => {})
.Convert(); converter.Load("").GetPossibleConversions();
converter.Load("").GetDocumentInfo();
converter.Load("").WithOptions(new PdfLoadOptions()).GetPossibleConversions();
converter.Load("").WithOptions(new PdfLoadOptions()).GetDocumentInfo();
public Converter(Supplier<InputStream> document)
Initializes new instance of Converter class.
Learn more More about how to load and convert documents stored at FTP, Amazon S3 Storage, Windows Azure or any other third-party storage: Loading document from different sources More about document loading options dependent on file type: Load options for different document types
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | java.util.function.Supplier<java.io.InputStream> | input stream supplier. |
public Converter(Supplier<InputStream> document, ConverterSettingsProvider settings)
Initializes new instance of Converter class. Learn more More about how to load and convert documents stored at FTP, Amazon S3 Storage, Windows Azure or any other third-party storage: Loading document from different sources More about document loading options dependent on file type: Load options for different document types
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | java.util.function.Supplier<java.io.InputStream> | An input stream supplier. |
| settings | ConverterSettingsProvider | A Converter settings supplier. |
public Converter(Supplier<InputStream> document, LoadOptionsProvider loadOptions)
Initializes new instance of Converter class. Learn more More about how to load and convert documents stored at FTP, Amazon S3 Storage, Windows Azure or any other third-party storage: Loading document from different sources More about document loading options dependent on file type: Load options for different document types
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | java.util.function.Supplier<java.io.InputStream> | An input stream supplier. |
| loadOptions | LoadOptionsProvider | A load options supplier. |
public Converter(Supplier<InputStream> document, LoadOptionsProvider loadOptions, ConverterSettingsProvider settings)
Initializes new instance of Converter class. Learn more More about how to load and convert documents stored at FTP, Amazon S3 Storage, Windows Azure or any other third-party storage: Loading document from different sources More about document loading options dependent on file type: Load options for different document types
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | java.util.function.Supplier<java.io.InputStream> | An input stream supplier. |
| loadOptions | LoadOptionsProvider | A document load options supplier. |
| settings | ConverterSettingsProvider | A Converter settings supplier. |
public Converter(Supplier<InputStream> document, LoadOptionsForFileTypeProvider loadOptions)
Initializes new instance of class. Learn more More about how to load and convert documents stored at FTP, Amazon S3 Storage, Windows Azure or any other third-party storage: Loading document from different sources More about document loading options dependent on file type: Load options for different document types
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | java.util.function.Supplier<java.io.InputStream> | An input stream supplier. |
| loadOptions | LoadOptionsForFileTypeProvider | The function that return document load options. |
public Converter(Supplier<InputStream> document, LoadOptionsForNameFileTypeStreamProvider loadOptions)
Initializes new instance of class. Learn more More about how to load and convert documents stored at FTP, Amazon S3 Storage, Windows Azure or any other third-party storage: Loading document from different sources More about document loading options dependent on file type: Load options for different document types
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | java.util.function.Supplier<java.io.InputStream> | A supplier that returns readable stream. |
| loadOptions | LoadOptionsForNameFileTypeStreamProvider | A function that returns document load options. |
Converter(Supplier document, LoadOptionsForNameFileTypeStreamProvider loadOptions, ConverterSettingsProvider settings)
public Converter(Supplier<InputStream> document, LoadOptionsForNameFileTypeStreamProvider loadOptions, ConverterSettingsProvider settings)
Initializes new instance of class. Learn more More about how to load and convert documents stored at FTP, Amazon S3 Storage, Windows Azure or any other third-party storage: Loading document from different sources More about document loading options dependent on file type: Load options for different document types
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | java.util.function.Supplier<java.io.InputStream> | A supplier that returns readable stream. |
| loadOptions | LoadOptionsForNameFileTypeStreamProvider | A function that returns document load options. |
| settings | ConverterSettingsProvider | A Converter settings supplier. |
public Converter(String filePath)
Initializes new instance of Converter class. Learn more More about how to load and convert documents stored at FTP, Amazon S3 Storage, Windows Azure or any other third-party storage: Loading document from different sources More about document loading options dependent on file type: Load options for different document types
Parameters:
| Parameter | Type | Description |
|---|---|---|
| filePath | java.lang.String | The file path to the source document. |
public Converter(String filePath, ConverterSettingsProvider settings)
Initializes new instance of Converter class. Learn more More about how to load and convert documents stored at FTP, Amazon S3 Storage, Windows Azure or any other third-party storage: Loading document from different sources More about document loading options dependent on file type: Load options for different document types
Parameters:
| Parameter | Type | Description |
|---|---|---|
| filePath | java.lang.String | The file path to the source document. |
| settings | ConverterSettingsProvider | A Converter settings supplier. |
public Converter(String filePath, LoadOptionsProvider loadOptions)
Initializes new instance of Converter class. Learn more More about how to load and convert documents stored at FTP, Amazon S3 Storage, Windows Azure or any other third-party storage: Loading document from different sources More about document loading options dependent on file type: Load options for different document types
Parameters:
| Parameter | Type | Description |
|---|---|---|
| filePath | java.lang.String | The file path to the source document. |
| loadOptions | LoadOptionsProvider | The load options supplier. |
public Converter(String filePath, LoadOptionsProvider loadOptions, ConverterSettingsProvider settings)
Initializes new instance of Converter class. Learn more More about how to load and convert documents stored at FTP, Amazon S3 Storage, Windows Azure or any other third-party storage: Loading document from different sources More about document loading options dependent on file type: Load options for different document types
Parameters:
| Parameter | Type | Description |
|---|---|---|
| filePath | java.lang.String | The file path to the source document. |
| loadOptions | LoadOptionsProvider | The document load options supplier. |
| settings | ConverterSettingsProvider | The Converter settings supplier. |
public Converter(String filePath, LoadOptionsForFileTypeProvider loadOptions)
Initializes new instance of class. Learn more More about how to load and convert documents stored at FTP, Amazon S3 Storage, Windows Azure or any other third-party storage: Loading document from different sources More about document loading options dependent on file type: Load options for different document types
Parameters:
| Parameter | Type | Description |
|---|---|---|
| filePath | java.lang.String | The file path to the source document. |
| loadOptions | LoadOptionsForFileTypeProvider | The document load options function. |
Converter(String filePath, LoadOptionsForFileTypeProvider loadOptions, ConverterSettingsProvider settings)
public Converter(String filePath, LoadOptionsForFileTypeProvider loadOptions, ConverterSettingsProvider settings)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| filePath | java.lang.String | |
| loadOptions | LoadOptionsForFileTypeProvider | |
| settings | ConverterSettingsProvider |
public Converter(String filePath, LoadOptionsForNameFileTypeStreamProvider loadOptions)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| filePath | java.lang.String | |
| loadOptions | LoadOptionsForNameFileTypeStreamProvider |
Converter(String filePath, LoadOptionsForNameFileTypeStreamProvider loadOptions, ConverterSettingsProvider settings)
public Converter(String filePath, LoadOptionsForNameFileTypeStreamProvider loadOptions, ConverterSettingsProvider settings)
Initializes new instance of class. Learn more More about how to load and convert documents stored at FTP, Amazon S3 Storage, Windows Azure or any other third-party storage: Loading document from different sources More about document loading options dependent on file type: Load options for different document types
Parameters:
| Parameter | Type | Description |
|---|---|---|
| filePath | java.lang.String | The file path to the source document. |
| loadOptions | LoadOptionsForNameFileTypeStreamProvider | The document load options function. |
| settings | ConverterSettingsProvider | The Converter settings supplier. |
public static void tweakPackageUtil(String vendor, String version, String specTitle)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| vendor | java.lang.String | |
| version | java.lang.String | |
| specTitle | java.lang.String |
public final void convert(SaveDocumentStream document, ConvertOptions convertOptions)
Converts source document. Saves the whole converted document. Learn more More about document conversion basic scenarios: How to convert document in 3 steps Conversion use cases, advanced settings and customizations: Convert document with advanced settings
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | SaveDocumentStream | The output stream supplier. |
| convertOptions | com.groupdocs.conversion.options.convert.ConvertOptions | The convert options specific to desired target file type. |
convert(SaveDocumentStream document, ConvertedDocumentStream documentCompleted, ConvertOptions convertOptions)
public void convert(SaveDocumentStream document, ConvertedDocumentStream documentCompleted, ConvertOptions convertOptions)
Converts source document. Saves the whole converted document. Learn more More about document conversion basic scenarios: How to convert document in 3 steps Conversion use cases, advanced settings and customizations: Convert document with advanced settings
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | SaveDocumentStream | output stream supplier |
| documentCompleted | ConvertedDocumentStream | the delegate that receive converted document stream. |
| convertOptions | com.groupdocs.conversion.options.convert.ConvertOptions | the convert options specific to desired target file type. |
public void convert(SaveDocumentStream document, ConvertOptionsProvider convertOptionsProvider)
Converts source document. Saves the whole converted document. Learn more More about document conversion basic scenarios: How to convert document in 3 steps Conversion use cases, advanced settings and customizations: Convert document with advanced settings
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | SaveDocumentStream | The output stream supplier. |
| convertOptionsProvider | ConvertOptionsProvider | Convert options provider. Will be called for each conversion to provide specific convert options to desired target document type. |
convert(SaveDocumentStream document, ConvertedDocumentStream documentCompleted, ConvertOptionsProvider convertOptionsProvider)
public void convert(SaveDocumentStream document, ConvertedDocumentStream documentCompleted, ConvertOptionsProvider convertOptionsProvider)
Converts source document. Saves the whole converted document. Learn more More about document conversion basic scenarios: How to convert document in 3 steps Conversion use cases, advanced settings and customizations: Convert document with advanced settings
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | SaveDocumentStream | The output stream supplier. |
| documentCompleted | ConvertedDocumentStream | The delegate that receive converted document stream. |
| convertOptionsProvider | ConvertOptionsProvider | Convert options provider. Will be called for each conversion to provide specific convert options to desired target document type. |
public void convert(SaveDocumentStreamForFileType document, ConvertOptions convertOptions)
Converts source document. Saves the whole converted document. Learn more More about document conversion basic scenarios: How to convert document in 3 steps Conversion use cases, advanced settings and customizations: Convert document with advanced settings
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | SaveDocumentStreamForFileType | Output stream function. |
| convertOptions | com.groupdocs.conversion.options.convert.ConvertOptions | The convert options specific to desired target file type. |
convert(SaveDocumentStreamForFileType document, ConvertedDocumentStream documentCompleted, ConvertOptions convertOptions)
public void convert(SaveDocumentStreamForFileType document, ConvertedDocumentStream documentCompleted, ConvertOptions convertOptions)
Converts source document. Saves the whole converted document. Learn more More about document conversion basic scenarios: How to convert document in 3 steps Conversion use cases, advanced settings and customizations: Convert document with advanced settings
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | SaveDocumentStreamForFileType | Output stream function |
| documentCompleted | ConvertedDocumentStream | The delegate that receive converted document stream |
| convertOptions | com.groupdocs.conversion.options.convert.ConvertOptions | The convert options specific to desired target file type |
public void convert(SaveDocumentStreamForFileType document, ConvertOptionsProvider convertOptionsProvider)
Converts source document. Saves the whole converted document. Learn more More about document conversion basic scenarios: How to convert document in 3 steps Conversion use cases, advanced settings and customizations: Convert document with advanced settings
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | SaveDocumentStreamForFileType | Output stream function. |
| convertOptionsProvider | ConvertOptionsProvider | Convert options provider. Will be called for each conversion to provide specific convert options to desired target document type. |
convert(SaveDocumentStreamForFileType document, ConvertedDocumentStream documentCompleted, ConvertOptionsProvider convertOptionsProvider)
public void convert(SaveDocumentStreamForFileType document, ConvertedDocumentStream documentCompleted, ConvertOptionsProvider convertOptionsProvider)
Converts source document. Saves the whole converted document. Learn more More about document conversion basic scenarios: How to convert document in 3 steps Conversion use cases, advanced settings and customizations: Convert document with advanced settings
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | SaveDocumentStreamForFileType | Output stream function. |
| documentCompleted | ConvertedDocumentStream | The delegate that receive converted document stream. |
| convertOptionsProvider | ConvertOptionsProvider | Convert options provider. Will be called for each conversion to provide specific convert options to desired target document type. |
public final void convert(String filePath, ConvertOptions convertOptions)
Converts source document. Saves the whole converted document. Learn more More about document conversion basic scenarios: How to convert document in 3 steps Conversion use cases, advanced settings and customizations: Convert document with advanced settings
Parameters:
| Parameter | Type | Description |
|---|---|---|
| filePath | java.lang.String | The file path to the source document. |
| convertOptions | com.groupdocs.conversion.options.convert.ConvertOptions | The convert options specific to desired target file type. |
public final void convert(SavePageStream document, ConvertOptions convertOptions)
Converts source document. Saves the converted document page by page. Learn more More about document conversion basic scenarios: How to convert document in 3 steps Conversion use cases, advanced settings and customizations: Convert document with advanced settings
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | SavePageStream | The page output stream function. |
| convertOptions | com.groupdocs.conversion.options.convert.ConvertOptions | The convert options specific to desired target file type. |
convert(SavePageStream document, ConvertedPageStream documentCompleted, ConvertOptions convertOptions)
public void convert(SavePageStream document, ConvertedPageStream documentCompleted, ConvertOptions convertOptions)
Converts source document. Saves the converted document page by page. Learn more More about document conversion basic scenarios: How to convert document in 3 steps Conversion use cases, advanced settings and customizations: Convert document with advanced settings
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | SavePageStream | The output stream function. |
| documentCompleted | ConvertedPageStream | The delegate that receive converted document page stream. |
| convertOptions | com.groupdocs.conversion.options.convert.ConvertOptions | The convert options specific to desired target file type. |
public void convert(SavePageStream document, ConvertOptionsProvider convertOptionsProvider)
Converts source document. Saves the converted document page by page. Learn more More about document conversion basic scenarios: How to convert document in 3 steps Conversion use cases, advanced settings and customizations: Convert document with advanced settings
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | SavePageStream | The output stream function. |
| convertOptionsProvider | ConvertOptionsProvider | Convert options provider. Will be called for each conversion to provide specific convert options to desired target document type. |
convert(SavePageStream document, ConvertedPageStream documentCompleted, ConvertOptionsProvider convertOptionsProvider)
public void convert(SavePageStream document, ConvertedPageStream documentCompleted, ConvertOptionsProvider convertOptionsProvider)
Converts source document. Saves the converted document page by page. Learn more More about document conversion basic scenarios: How to convert document in 3 steps Conversion use cases, advanced settings and customizations: Convert document with advanced settings
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | SavePageStream | Output stream function. |
| documentCompleted | ConvertedPageStream | The delegate that receive converted document page stream. |
| convertOptionsProvider | ConvertOptionsProvider | Convert options provider. Will be called for each conversion to provide specific convert options to desired target document type. |
public void convert(SavePageStreamForFileType document, ConvertOptions convertOptions)
Converts source document. Saves the converted document page by page. Learn more More about document conversion basic scenarios: How to convert document in 3 steps Conversion use cases, advanced settings and customizations: Convert document with advanced settings
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | SavePageStreamForFileType | An output stream function. |
| convertOptions | com.groupdocs.conversion.options.convert.ConvertOptions | The convert options specific to desired target file type. |
convert(SavePageStreamForFileType document, ConvertedPageStream documentCompleted, ConvertOptions convertOptions)
public void convert(SavePageStreamForFileType document, ConvertedPageStream documentCompleted, ConvertOptions convertOptions)
Converts source document. Saves the converted document page by page. Learn more More about document conversion basic scenarios: How to convert document in 3 steps Conversion use cases, advanced settings and customizations: Convert document with advanced settings
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | SavePageStreamForFileType | An output stream function. |
| documentCompleted | ConvertedPageStream | The delegate that receive converted document page stream. |
| convertOptions | com.groupdocs.conversion.options.convert.ConvertOptions | The convert options specific to desired target file type. |
public void convert(SavePageStreamForFileType document, ConvertOptionsProvider convertOptionsProvider)
Converts source document. Saves the converted document page by page. Learn more More about document conversion basic scenarios: How to convert document in 3 steps Conversion use cases, advanced settings and customizations: Convert document with advanced settings
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | SavePageStreamForFileType | An output stream function. |
| convertOptionsProvider | ConvertOptionsProvider | Convert options provider. Will be called for each conversion to provide specific convert options to desired target document type. |
convert(SavePageStreamForFileType document, ConvertedPageStream documentCompleted, ConvertOptionsProvider convertOptionsProvider)
public void convert(SavePageStreamForFileType document, ConvertedPageStream documentCompleted, ConvertOptionsProvider convertOptionsProvider)
Converts source document. Saves the converted document page by page. Learn more More about document conversion basic scenarios: How to convert document in 3 steps Conversion use cases, advanced settings and customizations: Convert document with advanced settings
Parameters:
| Parameter | Type | Description |
|---|---|---|
| document | SavePageStreamForFileType | An output stream function. |
| documentCompleted | ConvertedPageStream | The delegate that receive converted document page stream. |
| convertOptionsProvider | ConvertOptionsProvider | Convert options provider. Will be called for each conversion to provide specific convert options to desired target document type. |
public IConversionFrom withSettings(ConverterSettingsProvider settingsProvider)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| settingsProvider | ConverterSettingsProvider |
Returns: IConversionFrom
public IConversionLoadOptionsOrSourceDocumentLoaded load(String fileName)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| fileName | java.lang.String |
Returns: IConversionLoadOptionsOrSourceDocumentLoaded
public IConversionLoadOptionsOrSourceDocumentLoaded load(String[] fileNames)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| fileNames | java.lang.String[] |
Returns: IConversionLoadOptionsOrSourceDocumentLoaded
public IConversionLoadOptionsOrSourceDocumentLoaded load(DocumentStreamProvider documentStreamProvider)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| documentStreamProvider | DocumentStreamProvider |
Returns: IConversionLoadOptionsOrSourceDocumentLoaded
public IConversionLoadOptionsOrSourceDocumentLoaded load(DocumentStreamsProvider documentStreamProvider)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| documentStreamProvider | DocumentStreamsProvider |
Returns: IConversionLoadOptionsOrSourceDocumentLoaded
public final IDocumentInfo getDocumentInfo()
Gets source document info - pages count and other document properties specific to the file type. Learn more Learn more about converted document - file type, pages count, creation date and many other format specific properties: How to get document info
Returns: IDocumentInfo - document info
public boolean isDocumentPasswordProtected()
Checks is source document is password protected
Returns: boolean - true if document is password protected Learn more Learn more about converted document - file type, pages count, creation date and many other format specific properties: How to check is the document password protected
public final PossibleConversions getPossibleConversions()
Gets possible conversions for the source document. Learn more Learn more about supported conversions: Full list of supported conversions Learn more about available conversions: How to get supported conversions in code
Returns: PossibleConversions - possible conversions
public static List<PossibleConversions> getAllPossibleConversions()
Gets all supported conversions Learn more Learn more about supported conversions: Full list of supported conversions Learn more about available conversions: How to get supported conversions in code
Returns: java.util.List<com.groupdocs.conversion.contracts.PossibleConversions> - supported conversions
public static PossibleConversions getPossibleConversions(String extension)
Gets supported conversions for provided document extension Converter.GetPossibleConversions(".docx") Converter.GetPossibleConversions(“docx”) Learn more Learn more about supported conversions: Full list of supported conversions Learn more about available conversions: How to get supported conversions in code
Parameters:
| Parameter | Type | Description |
|---|---|---|
| extension | java.lang.String | Document extension |
Returns: PossibleConversions - possible conversions
public final void dispose()
Releases resources.
public void close()
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.