Image replacement using SVG templates for the DGS system

From RTS Support
Jump to: navigation, search

The DGS system supports replacing images in SVG templates provided to it. This allows images to contain images which can be replaced by the DGS system when producing the final output images. A common usage for this feature is to provide for user photos on their business cards in the LetterMark.NET system.

The process for doing so is quiet simple, however support for it in the various editors typically used to author SVG files is lacking or non-existent, as such we will cover the process of setting up an SVG file for image replacement by manually editing the SVG file in a text editor which is more complex.

This example assumes you are creating a template image for the LetterMark.NET system. The following files are used in this example and you should download them to a work area on your computer before continuing.

  • This document assumes that you know how to safely edit XML files. The SVG format is simply a specific type of XML file, and as such it must follow all the rules for properly formatted XML files. Documents that are not valid will be rejected by the image processor in most cases, in rare cases however the system may continue to process an invalid SVG file and produce unexpected output. Due to this possiblity, you should always verify your SVG files load properly with the DGS previewer before uploading them to the server. If at any point you find a difference between what you see in the previewer and what you see on the server than it is likely a bug and should be reported, however before doing so, please download the latest DGS Previewer installer to ensure you are in sync with the server. The DGS Previewer is available here.
    • If the DGS previewer does not provide enough information about a problem with the SVG, you may find the W3C document validator to provide more useful information. The W3C XML validator can be found here: http://validator.w3.org/
      • The W3C also offers a validator specific to SVG documents, however it seems to be unavailable more often than not. It is included here for completeness, your milage with it may vary. http://jiggles.w3.org/svgvalidator/
  1. Error creating thumbnail:
    - This is our SVG template, which will have one of its images replaced with an external one.
  2. Image:Smiley.png - This is the image which will appear after the replacement has been done.
  3. Image:Frowny.png - This is the image embedded into the template file as a place holder. It will be replaced by the new image when processed by the system.
  4. File:DGSExampleVariablesPackage.xml - This file is a DGS Previewer Package which is used with the DGS Previewer, it contains the commands and files required for the previewer to display the final output as if it had been processed by the server.