DITA and XMetaL Discussion

XMetaL Community Forum DITA and XMetaL Discussion XMetaL 5.5 EE and Visio SVG problem

  • dlemkuil

    XMetaL 5.5 EE and Visio SVG problem

    Participants 5
    Replies 6
    Last Activity 11 years, 7 months ago

    Windows XP V.2002 SP2
    XMetaL Author Enterprise 5.5.0.219
    IE 8
    Adobe SVG Viewer
    Visio 2003

    I'm stumped! I'm saving a Visio 2003 flowchart that contains lines with arrows in it as an SVG file. When I insert it into an XMetaL DITA task, it comes in with a small viewbox so I only see the upper left corner of the graphic. I can pan the graphic inside that small viewbox and see the graphic as it should be with all the lines and arrows. If I remove the arrows from the Visio file and resave as SVG, it comes into XMetaL just fine with the correct size viewbox (I can see the whole graphic). Why is XMetaL Author unable to interpret Visio arrows in an SVG file? I can open the SVG directly in a browser window and it looks great.

    If I comment out the following code in the SVG, the graphic comes in with the right size viewbox minus the arrowheads:



    markerUnits=”strokeWidth”>


    markerUnits=”strokeWidth”>


    Anyone have a clue what I'm talking about and can help? Or am I doomed to convert all my Visio graphics to another software…or replace the arrows with a triangle shape?

    Thanks,
    Dave

    Reply

    Derek Read

    Reply to: XMetaL 5.5 EE and Visio SVG problem

    Open the SVG file in a text editor and check to see how the SVG tag is marked up. It should have @width and @height values. If there are units other than “in” or “cm” specified (no units is also OK as that defaults to pixels) then XMetaL is unable to convert them to an onscreen size in pixels and falls back to 200 x 200px.

    I have a script that addresses this that you can install. It adds support for “px”, “pc”, “pt”, and “mm” units. However, we're planning on including the same thing in our next update which is out soon so it might make sense to just hold off and get the update.

    Reply

    dlemkuil

    Reply to: XMetaL 5.5 EE and Visio SVG problem

    Actually Derek, you helped me figure that one out last June. At that time I was having trouble with Arbortext IsoDraw SVG files showing in a small viewbox. We added the code that includes “mm” and that fixed the problem. Apparently at that time I thought Visio SVGs worked okay, but I guess we hadn't tried one with arrows in it. I'll attach a screenshot of what I see in Author: the same Visio file saved as SVG without arrowheads and one saved with arrowheads. I was going to attach the SVG file but it won't let me.

    Reply

    Derek Read

    Reply to: XMetaL 5.5 EE and Visio SVG problem

    You can attach the SVG if you put it into a ZIP archive. I really can't say what the issue is without having a file to work with.

    Reply

    dlemkuil

    Reply to: XMetaL 5.5 EE and Visio SVG problem

    Good idea! (I'm a little slow)
    Thanks for checking it out.

    Dave

    Reply

    Derek Read

    Reply to: XMetaL 5.5 EE and Visio SVG problem

    This file does not have a namespace binding declared for a prefix that is being used (xlink). As such it cannot be loaded by the XML parser that XMetaL uses to determine the width and height of the SVG image (MSXML) because it considers the file invalid XML. Because it can't be loaded into MSXML the script cannot extract the width and height (and so the fallback value of 200 x 200px is used).

    On line 28 the following appears:

    xlink:href="#lend13" transform="scale(-4.5,-4.5) "/>

    Note the use of the xlink: namespace prefix.

    Using a text editor you could manually add the namespace binding to the file. In the listing below it is the second line.

    [code]xmlns:xlink=”http://www.w3.org/1999/xlink”
    xmlns:v=”http://schemas.microsoft.com/visio/2003/SVGExtensions/”
    width=”8.5in”
    height=”11in”
    viewBox=”0 0 612 792″
    xml:space=”preserve”
    color-interpolation-filters=”sRGB”
    class=”st9″>[/code]

    Here is a brief description of why this is necessary: https://jwatt.org/svg/authoring/#namespace-binding
    In your files that work I suspect that the binding does not exist either, but the prefix is also not used (so the binding is not needed). In this particular file the namespace prefix is used and so the binding should be there.

    Please follow up with Microsoft to see if they are aware of this issue. Perhaps they have a patch that will allow your version of Visio to include this namespace binding automatically when you export.

    Reply

    dlemkuil

    Reply to: XMetaL 5.5 EE and Visio SVG problem

    I had narrowed it down to that line, as well, but had no idea what it meant. Thanks for the detailed description and code, it works! We can probably find a program that can go through the SVGs with arrows and add that line. As for Microsoft, I'll give it a shot, but considering what they've done to Visio since they took it over…I'm a little pessimistic.

    As always, thanks for your help.

    Dave

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support