[xep-support] [HOW-TO] Embed multimedia (Flash) in PDFs through oXygen and XEP

From: Gibbons, Dave (Hillsboro) <David.Gibbons@Fiserv.com>
Date: Fri Aug 20 2010 - 13:48:35 PDT

Kevin Brown at RenderX asked me to post this solution, also posted to DITA-USERS at Yahoo.

My company uses oXygen and the DITA-OT to produce documentation in XHTML and PDF. We're starting to use Flash on the XHTML side. One of the content producers I work with asked if we could use Flash in PDF, which seemed reasonable, since PDF supports Flash. The DITA-OT, however, was having none of it.

I spoke with Radu Coravu at SyncRO Soft (oXygen, oxygenxml.com) about this, and he came up with a neat solution. Here is his message, followed by some additional tweaking I did.


Oxygen uses the DITA Open Toolkit to process DITA Maps and Topics to different output formats.

You are using an older version of Oxygen which is bundled with DITA OT 1.4.3. [EDIT: I had replaced that version with 1.5, but Radu didn't know that. -DG] This older version of Oxygen also has the particularity that the topic to PDF transformation is not performed using the DITA OT ANT scripts but by applying a stylesheet. So for example if in your topic you have content references they will not show up correctly if the topic gets transformed directly to PDF. But if you transform a DITA Map in the DITA Maps Manager view which links to this topic, the output should be correct.

But from what I see (not even in the newest DITA OT version) the DITA to PDF output does not treat <object> elements at all when building the FO file.

For example open in Oxygen the following file:


It has a template which matches objects:

<xsl:template match="*[contains(@class,' topic/object ')]"> <fo:inline xsl:use-attribute-sets="object" id="{@id}"> </fo:inline> </xsl:template>

but which does not output anything from them. You can try changing this template to something like:

<xsl:template match="*[contains(@class,' topic/object ')]"> <fo:block xsl:use-attribute-sets="object" id="{@id}"> <rx:media-object xmlns:rx="http://www.renderx.com/XSL/Extensions"

The transformation should then produce a FO output which contains the extension object specified correctly.

Radu Coravu
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger


I made that change ran the transformation through XEP to produce a PDF. It worked perfectly.

Here is the code I used in the XML source file:

     <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
         <desc>A description of the task</desc>
         <param name="movie" value="c:\pdf2\movie1.swf"/>
         <param name="quality" value="high"/>
         <param name="bgcolor" value="#FFFFFF"/>

The problem I found was that the Flash content dimensions the content producers preferred for the Web were too wide for our default PDF pages. I added attributes to the <object> element ("pdfheight" and "pdfwidth") in commonelementsmod.xsd and commonelements.mod, and changed Radu's code in commons.xsl to output those values instead of the regular height and width values.


I added these attributes to the <object> element above:


That worked perfectly, too. The DITA source files validate correctly in oXygen and ANT, and the FO file that is produced works seamlessly with XEP.

I suspect a more elegant solution would be to scale the height and width values in the XSLT, and I'll probably try that next. Ideas and feedback welcome, of course.

The PDFs look beautiful through XEP, and the multimedia elements (screen shots with mouseovers, mostly) are getting raves from everyone who sees them.

-Dave Gibbons

(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo@renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/terms-of-service.html

Received on Fri Aug 20 13:55:42 2010

This archive was generated by hypermail 2.1.8 : Fri Aug 20 2010 - 13:55:43 PDT