Reply to: .mobi output – is it possible?June 13, 2011 at 8:20 pm
Just had quick try of the Mobipocket Creator and got it working quite easily. See attached.
Here are some notes:
1) If you output using “Multiple HTML” from XMetaL Author Enterprise you will end up with multiple HTML files (one for each DITA input topic). The Mobipocket Creator GUI doesn't support selecting multiple files when you click “Add” but you can drag and drop files.
2) It doesn't automatically find images that are linked to. You must also manually “Add” those to your project.
3. The GUI doesn't support folders but the “Build” step seems to. So, if you store your DITA files in multiple folders (which most people do) the folder structure replicated the DITA OT. This makes it difficult to get working with Mobipocket Creator but not impossible. Hand editing the file it saves for your “project” with *.opf file extension can be done and the “Build” step seems to support folder paths. It is the *.opt file that is used as input to generate the ebook, which has *.prc file extension. You can open the *.opf file in a text editor and fix links by adding folder paths and the code that generates the *.prc file seems to understand that, but this would be some amount of work to do if you have lots of files stored in different folders.
So, instead of doing that I generated output using “Single HTML”. That gives you a single HTML file containing all topics including a simple table of contents at the top. When Mobipocket Creator reads this file in there isn't anything else that needs to be done for output (unless you have links to images). The TOC seems to work just fine in my testing using “”.
Note that Mobipocket suggests that a read is included. That wasn't true in my case. I needed to download and install a separate program called “” in order to view the ebook output (the *.prc file).
If you do have images and they are stored relative to your original DITA documents but in different folders then the DITA OT replicates those folder paths. You have three options here (from best to worst in my opinion):
A) Get XMetaL Author Enterprise to Output a Single HTML File and the Images it References in the Same Folder
We have a setting not intended for this but it should work in this case. What it does is add an additional step prior to passing all files to the DITA OT. This step copies all files referenced in your map into a temporary folder, including images and renames them using 8.3 format filenames (randomly generated using ASCII alphanumeric characters only) and all links to all files are rewritten (in these temp files) so that they all reference the proper filenames in this folder. The original purpose for this was to force file naming compatibility for the DITA Open Toolkit in the case where characters are used in filenames that are not supported by the DITA OT (XMetaL Author Enterprise – Japanese edition ships with this enabled by default for example).
1. In XMetaL Author Enterprise select Tools > Configure Output.
2. Select the “Single HTML file” deliverable then press the Duplicate button. This will allow us to set up a custom deliverable we will use just for Mobipocket Creator so we can continue to use the standard deliverable “Single HTML file” (in case we want that).
3. Select the deliverable called “Copy of Single HTML file” then click the Edit button.
4. Rename the deliverable so it makes sense. In my case “Single HTML file for Input to Mobipocket Creator”.
5. On the Advanced tab in the section called “Other output parameters” add the following setting (it should probably be the only one you have there):
cmd_fs_sandboxing = yes
Now when you generate output using the deliverable named “Single HTML file for Input to Mobipocket Creator” you should get a single HTML file in your output folder along with all of your images (if any).
To create your ebook using Mobipocket Creator you would just create a new project in that product's GUI, then drag and drop the single HTML file generated by XMetaL plus any images it references. You can easily find these files by selecting “Open Folder” when XMetaL finishes generating output. Then do whatever else needs to be done and select “Build”.
B) Store DITA Files and Images in the Same Folder
Copy all of your DITA topics and files so that they are in the same folder. I would not recommend this but it is an option for people that might happen to already be working this way. For example, you might have a small set of DITA files for a particularly simple piece of documentation and happen to have already done this for simplicity. Not that if you happen to be working this way option (A) will also still work.
C) Hand Edit
Use the “Save” feature in Mobipocket Creator to save the *.opf file, then open it in a text editor and fix the paths to any images that need fixing (in my case by adding “image” before all image paths in href attributes. Then reopen the new *.opf file in Mobipocket Creator before clicking the Build button. I would not recommend working this way either. It was basically how I figured out what Mobipocket does and what it supports as input.