Converting CGM Images to SVG
PTC Arbortext Content Delivery provides the capability to convert CGM images in your data to SVG images. SVG images have the same quality as CGM, but do not require a web browser plug-in to view the image.
To convert CGM graphics to SVG, you must have a CGM to SVG converter. The conversion takes place when the data is published, before it is loaded into the system. The Larson CGM Engine converter is provided as an installation add-on with PTC Arbortext Content Delivery. When Larson is installed, CGM images are automatically converted to SVG when you select that option.
If you want to use a different converter, you must configure the system to support that converter. The converter is installed as a plug-in on the Publisher server. Follow these steps to implement the converter:
1. Define a component named CustomCGMtoSVGConverter in a custom content configuration file.
The configuration file must be located in the CONFIG/System/Config directory. You can use an existing file there, such as customizedContext_3.conf.xml, but it is recommended that you create a new file. The file must be named customizedContext_X.conf.xml, where X is any number. While the component can be in more than one file, the system always uses the component from the file with the highest number.
You can configure the converter specific properties in this component. These properties are accessible to the component class through the following method:
public void configure(IConfiguration conf) throws ConfigurationException {
The configuration parameters declared in the configuration file can be accessed using various methods defined in the IConfiguration interface present in the Framework.jar file with the package path com/enigma/sdk/framework/configuration. The Framework.jar file is located at HOME\SW\SW\System\WildFly\modules\system\layers\base\com\ptc\e3c\main.
2. Create a Java class (for example CustomCGMtoSVGConverter) for the CGM to SVG converter by extending the class com.enigma.imageConverter.ImageConverter located in the SCEImageConverter.jar file.
3. Create a method named convertCGMToSVG with three String parameters such as input folder, output folder, and output format.
This method should convert the CGM images present in the input folder into the SVG images and place them in the output folder.
4. Overwrite the execute(Map variables, String method) method.
If the method name is convertCGMToSVG, then from the variables map you can extract following parameters:
//input folder

String input = (String) variables.get("input");

//output folder

String output = (String) variables.get("output");

//output format

String outputFormat = (String) variables.get("outputFormat")
Next, call the method defined in step 2 with the above parameters. It is expected that CGM files present in the input folder are converted to an SVG file and put in the output folder.
5. Update the Load specific flow for image conversion.
6. Update the CGM to SVG converter component and the method name used in the ConvertCGMToSVGNode node of the CGMtoSVGConverterSubFlow_PD.xml sub-flow.
The component and method name must be the same as defined in steps 2 and 4. The method to be invoked should be defined in the custom class created in step 1.
Once you have implemented the converter, follow these steps to customize the CGM to SVG processing:
1. Add the following property in the customizedContext_3.conf.xml file located in the CONFIG/System/Config directory:
<Component Name="CustomCGMToSVGConvertor">
<Creation Type="JavaObject">
<!-- class name with package -->
<Class>com.custom.imageConverter.CustomCGMToSVGConvertor</Class>
</Creation>
<Config>
<!-- Pass various configuration parameters for converter into the Component -->
<!-- User can define attributes as
<attribute1>value</attribute1>
<attribute2>value</attribute2>
-->
</Config>
</Component>
2. Update the contentManagerFlow_PD.xml file located in the CONFIG/System/Config/Flows/ContentManager directory to include the following preprocessing nodes:
<start-state name="start">
<transition to="runConvertImagesSubFlow"/>
</start-state>

<!-- Normalize sources -->
<node name="runCMPublishNormalizeSubFlow">
<action class="com.enigma.workflowengine.handlers.FlowActionHandler" config-type="handler">
<processDefinitionPath>${enigma.config.home}/System/Config/Flows/ContentManager/
cmPublishNormalizeFlow_PD.xml</processDefinitionPath>
</action>
<transition name="failure" to="End"/>
<transition name="success" to="runConvertImagesSubFlow"/>
<transition name="reenter" to="runCMPublishNormalizeSubFlow"/>
</node>

<node name="runConvertImagesSubFlow">
<action class="com.enigma.workflowengine.handlers.FlowActionHandler" config-type="handler">
<processDefinitionPath>${enigma.config.home}/System/Config/Flows/ContentManager/
convertImagesFlow_CustomPD.xml</processDefinitionPath>
<monitoringName>Run Convert Images Flow</monitoringName>
</action>
<transition name="failure" to="End"/>
<transition name="success" to="runCheckGlobalDiskSpaceFlow"/>
<transition name="reenter" to="runConvertImagesSubFlow"/>
</node>

<node name="runCheckGlobalDiskSpaceFlow">
<action class="com.enigma.workflowengine.handlers.FlowActionHandler" config-type="handler">
<processDefinitionPath>${enigma.config.home}/System/Config/Flows/ContentManager/
checkGlobalDiskSpaceFlow_PD.xml</processDefinitionPath>
<monitoringName>Check Disk Space</monitoringName>
</action>
<transition name="failure" to="End"/>
<transition name="success" to="runHandlePDFLinksFlow"/>
<transition name="reenter" to="runCheckGlobalDiskSpaceFlow"/>
</node>


<!-- Setup profile path.
<node name="getProfilePath">
<action class="com.enigma.workflowengine.handlers.ProcessActionHandler" config-type="handler">
<contextName>ContentManager.Application.BusinessLogic</contextName>
<componentName>PacketDeployer</componentName>
<methodName>getProfilePath</methodName>
<profileName>${profile_name}</profileName>
<monitoringName>Retrieve Profile Path</monitoringName>
</action>
<transition name="failure" to="End"/>
<transition name="success" to="runHandlePDFLinksFlow"/>
<transition name="reenter" to="getProfilePath"/>
</node>
-->

<node name="runHandlePDFLinksFlow">
<action class="com.enigma.workflowengine.handlers.FlowActionHandler" config-type="handler">
<processDefinitionPath>${enigma.config.home}/System/Config/Flows/ContentManager/
handlePDFLinksFlow_PD.xml</processDefinitionPath>
<monitoringName>Handle PDF Links</monitoringName>
</action>
<transition name="failure" to="End"/>
<transition name="success" to="TypeOfCMScriptDecision"/>
<transition name="reenter" to="runHandlePDFLinksFlow"/>
</node>

<decision name="TypeOfCMScriptDecision">

<transition name="failure" to="End"/>
<transition name="CreateCMScriptFlow" to="runCreateCMScriptFlow">
<condition expression="#{S1000D_publication != 'true'}" />
</transition>
<transition name="CreateCMScriptForS1000DFlow" to="runCreateCMScriptForS1000DFlow">
<condition expression="#{S1000D_publication == 'true'}" />
</transition>
</decision>


<node name="runCreateCMScriptFlow">
<action class="com.enigma.workflowengine.handlers.FlowActionHandler" config-type="handler">
<processDefinitionPath>${enigma.config.home}/System/Config/Flows/ContentManager/
createCMScriptFlow_PD.xml</processDefinitionPath>
<monitoringName>Create Script</monitoringName>
</action>
<transition name="failure" to="End"/>
<transition name="success" to="extractFeedIds"/>
<transition name="reenter" to="runCreateCMScriptFlow"/>
</node>


<node name="runCreateCMScriptForS1000DFlow">
<action class="com.enigma.workflowengine.handlers.FlowActionHandler" config-type="handler">
<processDefinitionPath>${enigma.config.home}/System/Config/Flows/ContentManager/
createCMScriptFlowForS1000D_PD.xml</processDefinitionPath>
<monitoringName>Create Script For S1000D</monitoringName>
</action>
<transition name="failure" to="End"/>
<transition name="success" to="extractFeedIds"/>
<transition name="reenter" to="runCreateCMScriptForS1000DFlow"/>
</node>

<!-- Copy contents before this node -->
<node name="extractFeedIds">
3. Add a new property to the convertCGMToSVGFlow_PD.xml file located in the CONFIG/System/Config/Flows/ContentManager directory.
To do this, first comment out the last two lines in this part of the file:
<node name="ConvertCGMToSVGNode">
<action class="com.enigma.workflowengine.handlers.ProcessActionHandler" config-type="handler">
<contextName>DataProcess.Application.BusinessLogic</contextName>
<componentName>CGMToSVGConverter</componentName>
<methodName>doConvertViaPTCTool</methodName>
Next, add the following property below the commented lines:
<componentName>CustomCGMToSVGConvertor</componentName>
<methodName>convertCGMToSVG</methodName>
4. Compile the CustomCGMToSVGConvertor.java file and copy the CustomCGMToSVGConvertor.class file located in the HOME/SW/SW/System/WildFly/modules/system/layers/base/com/ptc/e3c/main/SCEImageConverter.jar/com/ptc/sce/imageConverter directory.
After finishing the configuration, run the Transform and Load task or Transform and Load CSV Data task with the Convert CGM to SVG option set to true to convert the graphics: