How can I save anchored frames as SVG during XML export?

Explorer ,
Aug 14, 2019

Copy link to clipboard

Copied

We have books with anchored-frame figures drawn with FrameMaker's native drawing tools. When we export these books as XML, the options in the read/write rules are to save these anchored frames as rasterized (PNG, GIF, etc.) or vector (MIF, CGM, or EPS).

 

However, we want the contents in SVG format, and attempting to write anchored frames as SVG results in

 

Cannot export the Framemaker graphic element () in the specified graphic format (SVG).

 

I've been pulling my hair out trying to find a batchable (linux or other) conversion path from MIF/CGM/EPS to SVGs. Has anyone found the magic solution for this?

 

TIA!

 

- Chris

TOPICS
Scripting

Views

2.2K

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

1 Correct Answer

Explorer , Aug 18, 2019
chrispitude Explorer , Aug 18, 2019
Thanks Wiedenmaier​ - we have a winner!Inkscape is indeed the best solution. At first I was using ghostscript for EPS-to-PDF, then Inkscape for PDF-to-SVG. But then I found that Inkscape also supports EPS as an input format, thus providing single-step conversion. And most importantly, it preserves the text as editable strings in the output SVG file.After you write out XML from FrameMaker with EPS files, you can use the following linux command to convert the EPS files to SVG files one-by-one (the...

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
Aug 14, 2019

Copy link to clipboard

Copied

Are you able to produce a pdf of a single graphic, place in Illustrator, and save to SVG?

If so, that should be a scriptable conversion

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Aug 17, 2019

Copy link to clipboard

Copied

Hi all,

Thanks for the suggestions! Wiedenmaier​, I bet that commercial service works great!  Unfortunately I have no budget from management for improving this aspect of conversion so I'm left to fend for myself.

First I saved the FrameMaker figures as CGM. I tried Uniconvertor but either the files wouldn't convert or there were artifacts in the conversion. Next I tried TotalCADConverter and this converts all files with just one artifact (hooray!) but the resulting SVG files are large and the text is not editable (it becomes individual character glyphs). Nonetheless, this became my baseline.

Next I saved the FrameMaker figures as MIF. I tried ReaConverter but after it ran two minutes on the first figure, I realized it wasn't going to handle several thousand figures too well.

Next I saved the FrameMaker figures as EPS. I tried eps2svg, which is provided by the "geg" package in Ubuntu. eps2svg itself is just a handy shell script wrapper around Ghostscript (EPS->PDF) and cairo (PDF->SVG). This works, the figures have no artifacts, and the SVGs are editable in Inkscape! The drawback is that again, the text is uneditable. But still, the results are visually 100% so now this becomes my baseline.

4everJang​ contacted me off-forum to ask for some test figures. He is working on better SVG generation capability that understands text frames, but unfortunately it's not quite up to my test figures yet.

My next step is to try to extract the MIF-to-SVG routines from inside the MIF2Go utility. Can anyone suggest where to start to look for that?

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Engaged ,
Aug 17, 2019

Copy link to clipboard

Copied

if you have EPS file, you can also try to convert to PDF with ghostscript and PDF can be converted to SVG with Inkscape. In our experience this process results in best results, at least for most of our cases.

You can also check out convert anything to anything - CloudConvert which provides very good results

Markus

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Aug 18, 2019

Copy link to clipboard

Copied

Thanks Wiedenmaier​ - we have a winner!

Inkscape is indeed the best solution. At first I was using ghostscript for EPS-to-PDF, then Inkscape for PDF-to-SVG. But then I found that Inkscape also supports EPS as an input format, thus providing single-step conversion. And most importantly, it preserves the text as editable strings in the output SVG file.

After you write out XML from FrameMaker with EPS files, you can use the following linux command to convert the EPS files to SVG files one-by-one (the -z option suppresses the GUI):

find ./xml -iname "*.eps" | sed 's/^\(.*\)\(\.eps\)$/-f \1\2 -l \1.svg/' | inkscape -z --shell

If you have many figures, you can use Inkscape's shell mode to convert them in batches of 20 for a bit more speed (I got spurious file-in-use errors if I pushed the batch size too large):

find ./xml -iname "*.eps" | sed 's/^\(.*\)\(\.eps\)$/-f \1\2 -l \1.svg/' | split -l 20 - inkscapetmp

ls -1 inkscapetmp* | xargs -n1 -I {} sh -c "cat {} | inkscape -z --shell; rm {}"

After you've converted the figures, update your *.e* FrameMaker XML entity files to change .eps references to .svg:

find ./xml -type f -name "*.e*" -print0 | xargs -0 sed -i 's/file="\([^"]*\).eps"/file="\1.svg"/'

If you see "** (inkscape:20347): CRITICAL **" warnings from Inkscape, you can ignore them. To suppress them, prepend dbus-run-session to the inkscape command as described here.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Oct 27, 2019

Copy link to clipboard

Copied

I've switched to the nightly 1.0 beta build of InkScape, installed via an AppImage. For this, the EPS-to-SVG batch conversion command is:

 

find ./xml/${*} -type f \( -iname \*.eps -o -iname \*.wmf \) -print0 | xargs -0 -n 50 /home/chrispy/ink/squashfs-root/AppRun -z --export-type=svg

 

InkScape 1.0* now supports batch conversion on its command line via --export-type, so no intermediate batch file is required. The call to "AppRun" instead of "inkscape" is how you run a program that's provided in a self-contained AppImage.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Aug 14, 2019

Copy link to clipboard

Copied

Hi Matt,

Thanks for your reply! I suspect it would, but we don't have Illustrator.   Plus I have on the order of several thousand figures, so runtime is a concern too.

I saw forum messages mentioning a freshly rewritten SVG export filter in the FDK in FrameMaker 2019, so I installed an evaluation copy. Unfortunately I get the same "Cannot export... (SVG)" message in the new version too. I guess the FDK export filter isn't plugged into the XML export too.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Advocate ,
Aug 14, 2019

Copy link to clipboard

Copied

@Matt - I doubt that the road via PDF would give any useful result - the PDF pulled into Illustrator might just be a bitmap inserted into an SVG shell, which is not really much better than the TIFF or other bitmap oriented graphics.

@Chris - I have code that turns Frame Graphics into an SVG. This is written in ExtendScript and can be combined with a script that runs through your documents and automatically names the SVG files plus enters the reference into the graphic. Basic FM graphics are handled (ellipses, text, color, boxes, polygons, as well as imported bitmaps which might have been the basis for the images when creating callouts on screen shots).

The scripting took time and I am making a living by creating time-saving scripts for FrameMaker. This implies that I will not hand over this code for free. If you contact me off-list and send me a bunch of samples I can check if my existing code will do the job and/or can be augmented to work for you. I am sure this would be hugely time consuming given the amount of work that would otherwise have to be redone from scratch in Illustrator - whcih you mention you do not have available anyway.

You can contact me by mail to jang at jang dot nl.

Kind regards

Jang AKA the Frame Tamer

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Employee ,
Aug 14, 2019

Copy link to clipboard

Copied

Hi Chris,

doubles now for you a little bit, as I had already replied to your email with this info, but for the others: The new SVG filter in FrameMaker 2019 has nothing to do with your scenario. The new filter improves import and rendering of existing SVGs that are linked as graphics into a FrameMaker (or XML) document: Much faster, better SVG support, better preview quality. It is NOT for converting FrameMaker graphic objects in an anchored frame to SVG. That's a completely different use case.

Regarding runtime: I guess the solution Matt suggested would be a one-time process, so runtime is probably not an issue. If that is an approach, you might want to think about a subscription for Illustrator (US$31.49/month) or maybe just hire someone like Matt to get it done for you once.

What I had also mentioned in my email, was that I had asked two Adobe Partners, from whom I think to remember that they have developed a solution for this (export content of an anchored frame as an SVG, then replace the anchored frame with the SVG).

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Engaged ,
Aug 14, 2019

Copy link to clipboard

Copied

@Matt, @Chris, @Jang: I've not that bad experience with the PDF way. You can fully automate this conversion with Inkscape. But of course it depends on what you want to do with this graphics later. Even WMF,EMF,EPS works well via a PDF to SVG.

@Chris: we don't have an Integration in FrameMaker itself. For Batch processing a lot of documents we have a solution with https:dts.c-rex.net, which processes MIF files. All objects in an anchor are converted to SVG and anchor Content is replaced by a reference to this created SVG graphic. It's also a commercial service.

But may be your description sounds like an Integration in FrameMaker, like Jang's scripts, would be the better approach for this use case. Please get in touch by PM or markus.wiedenmaier@c-rex.net , if you Need some further Information.

Markus

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Apr 30, 2020

Copy link to clipboard

Copied

Thanks to this thread, I'm looking into a similar conversion process. I can get my XML export to generate EPS images, but they all get a .gif extension instead of .eps.

Did you see that as well, and were you able to solve this in FrameMaker?

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Sep 17, 2020

Copy link to clipboard

Copied

Hobbes0022, double-check your write rules to make sure the output extension is correct:

 

export to file "$(docname).eps" as "EPS";

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more