Using Content Transformation Service | ||
---|---|---|
Previous | Next | |
Performance | Integrating with an LDAP Directory |
The Content Transformation Service provides transformations for content, such as:
The actual transformation is executed by a provider supporting the particular transformation.
The Content Transformation Service is available through the Content Server (Viewer module) and Transformation Server (Batch module). For both APIs you need to specify how the content should be transformed (transformation instruction) and optionally which provider to use. The instruction is passed directly to the provider, if specified. Otherwise, the instruction is passed to the enabled providers in a configured order, the first provider to support the given instruction is used. Rather than specifying the transformation instruction for each transformation, you can use a predefined transformation.
Commonly used transformation instructions can be registered and maintained as transformations in iKnowBase Development Studio (ikb$console > development > advanced > transformations).
A transformation contains:
See the “Providers” section for information about transformation instructions.
Note: A transformation instruction relate to output/target format, e.g. "
You can use a transformation in a content viewer to generate content server transformation links. The links will only be generated for the file formats and mime types included in the transformation.
You can use a transformation in one of the supported APIs, by referencing it either by its external key or its guid.
See iKnowBase Development Reference for further information.
To transform content using the HTTP API use a URL with the following format:
/Content/<document_id>/[attr=<document_attribute_guid/][version=<version_no>/]transformation=<reference|[provider:]instruction>/<filename>
You may specify which transformation to perform in one of two ways, either by referencing a predefined transformation or by using a transformation instruction directly (see the previous section “Transformation”). Both document content and document file attributes may be transformed.
The following table illustrates various ways to use the Content Server to convert a MS Word document to PDF.
URL | Description |
---|---|
/Content/123456/transformation=pdf/filename.docx | Transform the document content using the built-in pdf transformation, the highest priority provider that supports the transformation will be used |
/Content/123456/transformation=transformation_external_key/filename.docx | Transform the document content using the predefined transformation with the given external key |
/Content/123456/transformation=FEEDBEEF/filename.docx | Transform the document content using the predefined transformation with the given object guid |
/Content/123456/transformation=cloudconvert:pdf/filename.docx | Transform the document content using the cloudconvert provider and the given transformation instruction |
/Content/123456/attr=FEEDBEEF/transformation=fileconverter:pdf/filename.docx | Transform the document file attribute using the fileconverter provider and the given transformation instruction |
To transform content from PL/SQL there are two APIs available. You can either transform a blob or a content from a document. For both methods you must specify which transformation to perform, either by using a predefined transformation or by using a transformation instruction directly (see previous section “Transformation”).
Transformation from PL/SQL uses AQ and you can set a default maxWait for enqueuing/dequeuing operations. It accepts the following configuration property.
Property name | Description |
---|---|
com.iknowbase.batch.transformation.aq.maxWaitResponse | In seconds. If given it will be the default value if not given as input. If null, a timeout on 10 seconds will be used |
See iKnowBase PL/SQL Content Services API for further information.
Convert a blob:
declare
l_transformed_object blob;
begin
l_transformed_object := ikb_transformation_service.process (
p_file => :inputFile, -- (BLOB)
p_transformation => :transformation, -- string e.g pdf
p_maxWaitResponse => :maxWaitResponse);
end;
/
Convert the binary content from a document:
declare
l_transformed_object blob;
begin
l_transformed_object := ikb_transformation_service.process (
p_execution_user => :userreference,
p_documentreference => :documentreference,
p_document_attribute_guid => :document_attribute.object_guid,
p_transformation => :transformation, -- string e.g pdf
p_maxWaitResponse => :maxWaitResponse);
end;
/
The following table shows available providers with a flag indicating if the provider is automatically enabled.
Provider | Description | Automatically provided |
---|---|---|
CloudConvert | Supports a wide range of transformations via www.cloudconvert.com. Requires an account with www.cloudconvert.com. | No |
ImageEditor | Performs image operations such as resize, rotate, flip, crop and metadata extraction. | Yes |
FileConverter | Converts various file formats to PDF, HTML or images via Oracle Outside In. | No |
Oracle Multimedia | Performs image operations such as resize, rotate, flip, crop and metadata extraction for JPEG images. | Yes, provided ordsys.ordimage is available in the database |
Oracle Text | Converts various file formats to text or HTML. | Yes |
These following providers have specific installation requirements, see Content Transformation Providers:
The following sections documents each available provider, including supported transformation instructions.
Prefix: “cloudconvert”.
The CloudConvert content transformation provider supports a large set of transformations via www.cloudconvert.com, including among other things format transformation and image manipulation.
The default transformation settings will:
The CloudConvert provider accepts simple transformation instructions with or without transformation provider prefix:
The CloudConvert provider accepts advanced transformation instructions with or without transformation provider prefix. The options below may occur in any order.
Option name | Description | Datatype |
---|---|---|
callback | https://cloudconvert.com/api callback. Call this URL after completion. | URL |
converteroptions | https://cloudconvert.com/api converteroptions. Transformation settings customizations, see examples and API console. | Map |
https://cloudconvert.com/api email. true: Send email after conversion has been completed. | Boolean | |
mode | https://cloudconvert.com/api mode. [null] or “convert” is the default file conversion. “archive” if you need to archive a file to .zip or similar. Note that “combine”, “extract” and “info” is currently not supported. | String |
preset | https://cloudconvert.com/api preset. Transformation settings preset identifier. | String |
save | https://cloudconvert.com/api save. A preconfigured transformation. | Boolean |
tag | https://cloudconvert.com/api tag. A tag for finding your stuff later on. | String |
timeout | https://cloudconvert.com/api timeout. Timeout in seconds after the conversion will be cancelled. | Integer |
wait | true (default): wait until conversion has completed, or wait timeout. | Boolean |
maxwait | Max number of milliseconds we’ll wait for a completed conversion (defaults to 30 000 ms). | Integer |
waitinterval | Polling interval in milliseconds during wait. (defaults to 1 000 ms). | Integer |
The option converteroptions is a Map corresponding to https://cloudconvert.com/api of converteroptions for the transformation. Use www.cloudconvert.com’s API Console to find the configuration options you want. Note: They will be delimited with & (ampersand) in the API, while iKnowBase uses : (colon) as delimiter.
Instruction | Description |
---|---|
Instruction for pdf conversion. Since the provider prefix is omitted from the instruction, the highest priority provider which supports the “pdf” is used. | |
cloudconvert:pdf | Instruction for pdf conversion using the CloudConvert provider. |
cloudconvert:pdf:converteroptions[pdf_a]=true | Instruction for pdf conversion to PDF-A. |
cloudconvert:png:converteroptions[page_range]=1-5:converteroptions[density]=200 | Instruction for png conversion for page 1 to 5 with a density of 200. |
Prefix: “image”.
The ImageEditor provider performs image operations such as resize, rotate, flip, crop and metadata extraction and is used by the Image Archive for all image operations.
The ImageEditor provider accepts simple transformation instructions with or without transformation provider prefix:
The ImageEditor provider accepts advanced transformation instructions with transformation provider prefix:
Multiple operation options can be specified delimited by : (colon). Each operation may also take additional parameters. The table below gives an overview over available operations.
Operation | Description |
---|---|
none | No transformation |
resize | resize:width:height:mode, where mode is one of “best-fit-shrink”, “best-fit” or “exact” |
crop | resize:x:y:width:height |
autorotate | |
rotate90 | |
rotate180 | |
rotate270 | |
flipHorizontal | |
flipVertical | |
sharpen | |
Output format extension | |
Output format mimetype |
Instruction | Description |
---|---|
gif | Instruction for gif conversion. Since the provider prefix is omitted from the instruction, the highest priority provider which supports the “gif” is used. |
image:gif | Instruction for pdf conversion using the ImageEditor provider. |
image:autorotate:resize:95:95:best-fit-shrink | Instruction for auto rotate and resize transformation. The original file format is unchanged. |
Prefix: “fileconverter”.
The FileConverter is a content transformation provider that converts documents from a number of file formats, to PDF, HTML or a number of image formats.
The FileConverter provider accepts simple transformation instructions with or without transformation provider prefix:
The FileConverter provider accepts advanced transformation instructions with transformation provider prefix
FileConverter is also supported via the legacy database package BATCH_FILECONVERT_CLIENT.
Note: Mimetype in transformation instruction is not supported through the Content Server, due to conflicting “/”.
Note: Configuration files for the specified type needs to be present in the installed Oracle Outside In directory.
Prefix: “ordimg”.
The Oracle Multimedia provider performs image operations such as resize, rotate, flip, and crop for images.
The Oracle Multimeldia provider accepts simple transformation instructions without transformation provider prefix:
The Oracle Multimeldia provider accepts advanced transformation instructions with transformation provider prefix:
See Oracle’s documentation for “Image process( ) and processCopy( ) Operators” regarding valid operations.
Note: The advanced command format for Oracle Multimedia is incompatible with iKnowBase Content Server and cannot be used directly in the URL using transformation=. You need to register the transformation command
in ikb$console and use the transformation’s external key in the URL.
Prefix: “ctxdoc”.
The Oracle Text provider various file formats to text or HTML.
The Oracle Text provider accepts simple transformation instructions with or without transformation provider prefix:
All transformed content are cached in a database table (IKB_TRANSFORMATION_EDITIONS). A cached transformation result is only valid if the source content has not changed.
You may view the cache in ikb$console > services > transformations > cache.
A database job which cleans up the cache is by default configured to run periodically, see Schedule in iKnowBase Development Studio. It will remove non-current cache for iKnowBase documents (cache prefix “docref”) and old BLOB conversions (cache prefix “blob” - no iKnowBase document reference used).
You may also purge the cache table, but note that this will lead to initially longer response times as the cache needs to be regenerated.
Previous | Top | Next |
Performance | Integrating with an LDAP Directory |