Preserving image scaling in FrameMaker 7.1

April 13th, 2006

In FrameMaker 7.1, when you save documents to DocBook XML, the scaling on images gets lost, without the following workaround.

For example, this afternoon I was in the middle of writing a document and I added a mediaobject element, whose imagedata element referenced an EPS image file I'd created in Illustrator. I sized and positioned the image like I wanted it, within an anchored frame. Here's a screenshot of how it looked (note - the image you get in FrameMaker when you insert an EPS is a low definition TIFF that allows you to size/place the image):

FrameMaker-image.gif

However, when I saved and close the FrameMaker file and then reopened it, this is what I got:

FrameMaker-image2.gif

The sizing details are lost. Here's what was in the XML:

<para><mediaobject><imageobject>
<imagedata width = "5.281in" depth = "1.533in" align = "left"
entityref = "imagedata2" angle = "0.000"
cropped = "1" float = "0" nsoffset = "0.000in" position = "below"
xoffset = "0.674in" yoffset = "0.000in"/></imageobject></mediaobject></para>

It looks like the width and depth of the image are recorded, but actually these are the dimensions of the anchored frame.

Thanks to Steve Whitlach for providing the remedy:
www.getnet.com/~swhitlat/DocBook/Frame_Project_Readme.html

The trick is to map FrameMaker's "import size" property to a DocBook element. As usual the handy role element is the obvious choice. So, we need to add the following to the read-write rule for the imagedata element:

attribute "role" is fm property import size;
The "imagedata" section of my read-write rules file looks like this:
element "imagedata"
{
is fm graphic element "ImageData";
writer anchored frame
{
specify size in cm;
export to file "$(docname).eps" as "EPS";
}
attribute "fileref" is fm property file;
attribute "entityref"
{
is fm property entity;
is fm attribute;
}
attribute "align"
{
is fm property alignment;
value "left" is fm property value align left;
value "center" is fm property value align center;
value "right" is fm property value align right;
value "inside" is fm property value align inside;
value "outside" is fm property value align outside;
}
attribute "angle" is fm property angle;
attribute "bloffset" is fm property baseline offset;
attribute "cropped" is fm property cropped;
attribute "float" is fm property floating;
attribute "depth" is fm property height;
attribute "nsoffset" is fm property near-side offset;
attribute "position" is fm property position;
attribute "width" is fm property width;
attribute "dpi" is fm property dpi;
attribute "xoffset" is fm property horizontal offset;
attribute "yoffset" is fm property vertical offset;
attribute "role" is fm property import size;
}

This gives us the following XML:

<para><mediaobject><imageobject>
<imagedata width = "5.281in" depth = "1.533in" align = "left"
entityref = "imagedata2" role = "3.933in 1.392in" angle = "0.000"
cropped = "1" float = "0" nsoffset = "0.000in" position = "below"
xoffset = "0.674in" yoffset = "0.000in"/></imageobject></mediaobject></para>
Now the image dimensions are recorded as:
role = "3.933in 1.392in"

Comments are closed.