Reply to: Display Default ImageMarch 26, 2012 at 5:33 pm
XMetaL Author (and XMAX) do not natively support rendering PDF documents “inline” inside a document while editing (as they do with bitmap image formats such as JPG, BMP, GIF, PNG, etc). However, you can customize the product to render any file type provided you can find an ActiveX control that can do the actual rendering. Essentially you are embedding the ActiveX control into your XML document at the appropriate location (tied to some element) and then loading the file in question (PDF) into the ActiveX control. This is similar to embedding ActiveX controls into a Visual Basic application (though there is obviously no form editor in the case of XMetaL because the control might appear anywhere the user chooses to insert a corresponding element into a document for your particular DTD).
If you install a plug-in for Internet Explorer that can render PDF (such as the Adobe Reader plug-in for IE) then you can embed the Internet Explorer “WebBrowser” control (ProgID = Shell.Explorer) and allow it to render the PDF. It is often easiest to embed IE (WebBrowser control) because Microsoft has extensive documentation on working with that control's properties and methods.
You can often embed the ActiveX control directly (bypassing the need to embed the WebBrowser control) if you feel comfortable doing that, and perhaps the maker has provided enough documentation. However, many ActiveX controls are thoroughly tested for use with IE by the maker as IE is perhaps the most universal place ActiveX controls are used. In some cases that is the only testing they have done and so some controls have quirks that make them unsuitable for use in embedding into other platforms for this reason.
One example of how to do this is included with XMetaL Author's “Journalist DTD” demo customization. Normally the
section in the file C:Program FilesXMetaL 6.0AuthorRulesjournalist.ctm
- The two events “Graphic_OnShouldCreate” and “Graphic_OnInitialize” in the file C:Program FilesXMetaL 6.0AuthorMacrosjournalist.mcr (the names correspond to the setting in the CTM file).
The DITA authoring functionality included with XMetaL Author Enterprise 5.0 through 6.0 includes a similar solution for rendering SVG images in DITA documents. Similar CTM file settings are involved and the similar code inside *_OnShould and *_OnInitialize events come into play. In this case an SVG image rendering plug-in is required to be installed for Internet Explorer.
All of the CTM settings and APIs listed above are documented in the XMetaL Developer Customization Guide and Programmers Guide.
If you do not want to go through the trouble of doing any of the above then you can try two other options:
- Use the SetRenderedContent API. That API allows you to replace the content of a (visible) node with something else.
- Use a CSS :before or :after selector property to render an image before or after the node in question.
You might end up needing to use a combination of the two.