SDKLauncher-iOS icon indicating copy to clipboard operation
SDKLauncher-iOS copied to clipboard

Jump to a specific paragraph

Open higginator opened this issue 10 years ago • 2 comments

Hello.

Is there a way to jump to a specific paragraph within an epub? My end goal is to sync 2 books. When a user highlights a word in book1, I would like to know the paragraph id that this word belongs to. And then I would like to load book2, jumping to the location of the paragraph with the same id.

I see that I can do this on a page by page basis, using each spineItem's spineItemIndex and spineItemPageIndex and initializing/pushing to the navigationController a new EPubViewController. But I would like to narrow in to the paragraph level.

(Just thinking now...perhaps this would require giving each paragraph an id attribute when the epub's are being authored. <p id=1'>.......)

higginator avatar Aug 24 '15 18:08 higginator

The short answer is that you can target specific paragraphs in a unique fashion using CFIs (Canonical Fragment Identifiers). See http://www.idpf.org/epub/linking/cfi/epub-cfi.html.
The long answer will require some research and experimentation.

rkwright avatar Aug 24 '15 19:08 rkwright

You may also be interested in an upcoming EPUB3 feature called "Multiple Renditions" and in particular the "Mapping Document": http://www.idpf.org/epub/renditions/multiple/ There is an experimental implementation in ReadiumJS, see the epub3MultipleRenditions feature branch: https://github.com/readium/readium-js-viewer/tree/feature/epub3MultipleRenditions https://github.com/readium/readium-js/tree/feature/epub3MultipleRenditions https://github.com/readium/readium-shared-js/tree/feature/epub3MultipleRenditions

danielweck avatar Aug 25 '15 12:08 danielweck