Pages: 1
Print
Author Topic: Can you pull a PDF file into a bookmap?  (Read 206 times)
mtbowers
Member

Posts: 6


« on: August 30, 2011, 12:53:14 PM »

Need help with this one. I have an XMetal bookmap containing all the topics for a hardware manual. We have specs/drawings that are in PDF format only (8.5x11") and we want to pull the PDFs straight into the bookmap and the manual so that they appear as-is (no header/footer as in the rest of the pages in the manual) and they are very easy to update when new drawings come out. Converting them to another image format isn't an option for us right now. Is this possible? And if so, how?
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 1548



WWW
« Reply #1 on: August 30, 2011, 02:15:50 PM »

RenderX XEP (used by XMetaL Author Enhanced PDF via RenderX XEP deliverable) supports the embedding of PDFs within other PDFs, so yes, this would be possible. As it works right now if you create a topic, embed an <image> and reference a PDF file RenderX will attempt to embed the PDF inside the PDF that it is generating. There are limitations to this as XMetaL Author Enterprise and the DITA Open Toolkit are not really designed with this in mind, but you can get around those issues. To see this in action you can do the following:

1. Save your PDF to an empty folder (example: C:\EmbedTest\test.pdf)
2. Create a DITA topic in the same folder:
<?xml version="1.0"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="topic_4541BB9CB82148579CE3DEFE9EA9E3FB">
  <title>PDF Embedding Test</title>
  <body>
    <image href="test.pdf"
      id="image_FA6E1C37A0C14E358ED583ADE0A2C8E8"
      placement="inline"
      width="340px"
      height="440px"></image>
  </body>
</topic>

3. Generate output from the topic using the deliverable "XMetaL Enhanced PDF via RenderX XEP". At this point if you open the output PDF you will notice that the embedded PDF image is not there. This is because by default the DITA OT only copies certain image types (certain file extensions like JPG and GIF) into the right place for RenderX to locate them when it goes to embed them in the output PDF.
4. Manually copy the file "test.pdf" into the following folder:
C:\EmbedTest\pdf_out\Customization\OpenTopic\common\artwork\
5. Generate output again, using "XMetaL Enhanced PDF via RenderX XEP". This time the PDF image will be embedded inside your output PDF. I'm attaching both the test.pdf and my for reference.

You will note several issues with the above test because of the way the DITA OT currently works:
1. The image is included inside a topic and so appears on a page along with header and footer (exactly what you don't want).
2. The image has been scaled in order to fit on the page ("actual size" is 8.5 x 11inches in PDF land, but I have scaled it to 340x440px). RenderX and the DITA OT do not automatically scale images that do not fit inside a particular container block (this is in the XSL-FO). There are strategies for that, but in your case this would likely not be needed if your pages are all exactly the right size.
3. The DITA OT doesn't automatically copy the PDF image into the right place for RenderX to locate it.

So, to get what you are looking for would require customization work to be done to the DITA Open Toolkit. You may also need to decide how you wish to code the DITA map or specially coded topics that will contain references to these PDF files (a DITA specialization might make coding any XSLT easier but creating the specialized DTD would in itself add more work). These decisions would drive the changes needed in the XSLT that generates the XSL-FO used by RenderX to generate the PDF output (or the latter might drive the former). You might be able to get away with markup similar to what I have above, perhaps by adding a special identifier that can be used by the XSLT so that it knows this is a special topic and to generate the right XSL-FO for it. Perhaps something like this:

    <image outputclass="8x11FullPagePDF"
      href="test.pdf"
      id="image_FA6E1C37A0C14E358ED583ADE0A2C8E8"
      placement="inline"></image>

Alternatively (as you suggest) you might alter the code that handles bookmap files, so that you might have something like this in your bookmap:
    <topicref href="test.pdf" type="PDF">

These things would likely be a significant amount of work and a service one of our partners may be able to help with if you don't have anyone in house that is familiar with making changes to the DITA OT. Or you might be lucky and someone else may have already done something like this that they are willing to share. Two possible other locations for this type of information:
http://tech.groups.yahoo.com/group/dita-users/
http://tech.groups.yahoo.com/group/xmetal-dita/

Also note that in order to view the PDF inline while editing in XMetaL Author Enterprise would require customization of the editor itself. This would require some scripting work and a configuration changes but it can be done. Though I suspect it may not be a requirement in your case and that generating output is higher priority. This is also something our partners can generally help with.

* pdf_image_embed_test.zip (1848.76 KB - downloaded 26 times.)
« Last Edit: August 30, 2011, 02:23:35 PM by Derek Read » Logged
mtbowers
Member

Posts: 6


« Reply #2 on: August 30, 2011, 03:42:28 PM »

Thanks for the quick response! I will give this a try. Related to this topic (and I suppose the inherent limitations on just using the editor instead of modifying DITAOT); is it possible to create a different header/footer for this set of drawings? For example, the rest of my book has the standard XMetal book header/footer; however, I'd like this section (if I need to have a header/footer) to be date revised or something similar. As an analog, you can do this in MS Word by breaking up the document into sections and turning off the copy footer/header info from section to section.
Logged
gcrews
Member

Posts: 189


« Reply #3 on: August 30, 2011, 04:09:04 PM »

FYI, if you output to chm as well you may run into this issue:

There appears to be an issue with embedded files in CHM files and IE9.

http://social.technet.microsoft.com/Forums/bg-BG/w7itpronetworking/thread/2cd262\
dc-54d5-4929-8ae8-61d2c1aad11b

http://forums.adobe.com/message/3757069
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 1548



WWW
« Reply #4 on: August 30, 2011, 04:56:04 PM »

You could probably create separate pages with different headers and footers but this would be fairly tricky given the way the DITA OT has designed the page layout ordering (this is driven mostly by a file called layout-masters.xsl). You basically have body-even and body-odd pages. You might have to add new ones to do what you want.
Logged
Pages: 1
Print
Jump to: