4

I am trying to implement a idml to html converter. I've managed to produce a single flat html file similar to the one produced by the indesign export.

What I would like to do is to produce html that will be as similar as possible to the indesign view like an html idml viewer. To do this, I need to find the text that can fit into a textframe, I can extract the story text content but I can't really find a way to split this content into frames/pages.

Is there any way I can achieve that?

Wahyu Kristianto
  • 8,719
  • 6
  • 43
  • 68
dp901
  • 85
  • 2
  • 8

2 Answers2

5

Just extracting the text from a story isn't enough. The way the text is laid out is controlled by TextFrames in the Spread documents. Each TextFrame has a ParentStory attribute, showing which story it loads text from, and each frame has dimensions which determine the layout. For unthreaded text frames (ie. one story <> one frame), that's all you need.

For threaded frames, you need to use the PreviousTextFrame and NextTextFrame attributes to create the chain. There is nothing in the IDML to tell you how much text fits in each frame in a threaded chain, you need to do the calculation yourself based on the calculated text dimensions (or using brute force trial and error).

You can find the spreads in the main designmap.xml:

<idPkg:Spread src="Spreads/Spread_udd.xml" />

And the spread will contain one or more TextFrame nodes:

<Spread Self="udd" ...>
    <TextFrame Self="uf7" ParentStory="ue5" PreviousTextFrame="n" NextTextFrame="n" ContentType="TextType">...</>
    ...
</Spread>

Which will in turn link to a specific story:

<Story Self="ue5" AppliedTOCStyle="n" TrackChanges="false" StoryTitle="$ID/" AppliedNamedGrid="n">...</>

(In this example the frames are not threaded, hence the 'n' values.

All this is in the IDML documentation, which you can find with the other InDesign developer docs here: http://www.adobe.com/devnet/indesign/documentation.html

Jude Fisher
  • 11,138
  • 7
  • 48
  • 91
  • Thanks for the reply. This is exactly what i am currently trying to do. I just thought that maybe there was a predefined way of calculating the text that can fit in a frame which I was not aware of. – dp901 Nov 06 '12 at 12:33
  • No, not that I know of - you might find some .js out there to help but mostly it's a case of rolling your own. Good luck. – Jude Fisher Nov 06 '12 at 12:52
2

Microsoft and Adobe have proposed a new module for css named Regions which allow you to do flow tekst into multiple containers. Keep in mind that you will never be able to create an html page that looks exactly like an Indesign document.

http://www.w3.org/TR/css3-regions/

For now only IE10 and webkit nightly support it: http://caniuse.com/#feat=css-regions

ZippyV
  • 12,540
  • 3
  • 37
  • 52
  • My main issue was that there is no predefined way to calculate the text that can fit in a textframe. I don't think that the solution to this issue depends on the html element that one uses to display the extracted text. I might be wrong though as i haven't really looked into the use of regions. Thanks for the reply anyway – dp901 Jan 02 '13 at 17:18