Skip to content

Viewing direction and Its Effect on Navigation

Cookbook URLs
Recipe: https://iiif.io/api/cookbook/recipe/0010-book-2-viewing-direction/
JSON-LD Example 1: https://iiif.io/api/cookbook/recipe/0010-book-2-viewing-direction/manifest-rtl.json
JSON-LD Example 2: https://iiif.io/api/cookbook/recipe/0010-book-2-viewing-direction/manifest-ttb.json

Method 1 - Setting the viewingDirection property during object construction

Example 1

from iiif_prezi3 import Manifest, config

config.configs['helpers.auto_fields.AutoLang'].auto_lang = "en"
base_url = "https://iiif.io/api/cookbook/recipe/0010-book-2-viewing-direction"

manifest = Manifest(id=f"{base_url}/manifest-rtl.json",
                    label="Book with Right-to-Left Viewing Direction",
                    summary="Playbill for \"Akiba gongen kaisen-banashi,\" \"Futatsu chōchō kuruwa nikki\" and \"Godairiki koi no fūjime\" performed at the Chikugo Theater in Osaka from the fifth month of Kaei 2 (May, 1849); main actors: Gadō Kataoka II, Ebizō Ichikawa VI, Kitō Sawamura II, Daigorō Mimasu IV and Karoku Nakamura I; on front cover: producer Mominosuke Ichikawa's crest.",
                    viewingDirection="right-to-left")

canvas1 = manifest.make_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/4f92cceb12dd53b52433425ce44308c7-ucla_bib1987273_no001_rs_001",
                                         id=f"{base_url}/canvas/p1",
                                         label="front cover",
                                         anno_id=f"{base_url}/annotation/p0001-image",
                                         anno_page_id=f"{base_url}/page/p1/1")

canvas2 = manifest.make_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/4f92cceb12dd53b52433425ce44308c7-ucla_bib1987273_no001_rs_002",
                                         id=f"{base_url}/canvas/p2",
                                         label="pages 1–2",
                                         anno_id=f"{base_url}/annotation/p0002-image",
                                         anno_page_id=f"{base_url}/page/p2/1")

canvas3 = manifest.make_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/4f92cceb12dd53b52433425ce44308c7-ucla_bib1987273_no001_rs_003",
                                         id=f"{base_url}/canvas/p3",
                                         label="pages 3–4",
                                         anno_id=f"{base_url}/annotation/p0003-image",
                                         anno_page_id=f"{base_url}/page/p3/1")

canvas4 = manifest.make_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/4f92cceb12dd53b52433425ce44308c7-ucla_bib1987273_no001_rs_004",
                                         id=f"{base_url}/canvas/p4",
                                         label="pages 5–6",
                                         anno_id=f"{base_url}/annotation/p0004-image",
                                         anno_page_id=f"{base_url}/page/p4/1")

canvas5 = manifest.make_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/4f92cceb12dd53b52433425ce44308c7-ucla_bib1987273_no001_rs_005",
                                         id=f"{base_url}/canvas/p5",
                                         label="back cover",
                                         anno_id=f"{base_url}/annotation/p0005-image",
                                         anno_page_id=f"{base_url}/page/p5/1")

print(manifest.json(indent=2))

Example 2

from iiif_prezi3 import Manifest, config

config.configs['helpers.auto_fields.AutoLang'].auto_lang = "en"
base_url = "https://iiif.io/api/cookbook/recipe/0010-book-2-viewing-direction"

manifest = Manifest(id=f"{base_url}/manifest-ttb.json",
                    label="Diary with Top-to-Bottom Viewing Direction",
                    summary="William Lewis Sachtleben was an American long-distance cyclist who rode across Asia from Istanbul to Peking in 1891 to 1892 with Thomas Gaskell Allen Jr., his classmate from Washington University. This was part of a longer journey that began the day after they had graduated from college, when they travelled to New York and on to Liverpool; in all they travelled 15,044 miles by bicycle, 'the longest continuous land journey ever made around the world' as reported in their book <cite>Across Asia on a bicycle</cite> (1895). Sachtleben documented his travels with photographs and diaries, the latter of which he numbered sequentially. The diary of notebook 'No. 10' covers a portion of their journey through the Armenian area of Turkey from April 12 to May 9 (there is a 2-page reading list at the end). During this time they rode from Ankara (Angora in the diary) to Sivas, where they stayed for ten days while Allen had a bout of typhoid fever, and the first half of a ten-day excursion to Merzifon (Mersovan in the diary), taken by Sachtleben to give Allen additional time to recover.",
                    viewingDirection="top-to-bottom")
canvas1 = manifest.make_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/9ee11092dfd2782634f5e8e2c87c16d5-uclamss_1841_diary_07_02",
                                         id=f"{base_url}/canvas/v1",
                                         label="image 1",
                                         anno_id=f"{base_url}/annotation/v0001-image",
                                         anno_page_id=f"{base_url}/page/v1/1")

canvas2 = manifest.make_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/9ee11092dfd2782634f5e8e2c87c16d5-uclamss_1841_diary_07_03",
                                         id=f"{base_url}/canvas/v2",
                                         label="image 2",
                                         anno_id=f"{base_url}/annotation/v0002-image",
                                         anno_page_id=f"{base_url}/page/v2/1")

canvas3 = manifest.make_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/9ee11092dfd2782634f5e8e2c87c16d5-uclamss_1841_diary_07_04",
                                         id=f"{base_url}/canvas/v3",
                                         label="image 3",
                                         anno_id=f"{base_url}/annotation/v0003-image",
                                         anno_page_id=f"{base_url}/page/v3/1")

canvas4 = manifest.make_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/9ee11092dfd2782634f5e8e2c87c16d5-uclamss_1841_diary_07_05",
                                         id=f"{base_url}/canvas/v4",
                                         label="image 4",
                                         anno_id=f"{base_url}/annotation/v0004-image",
                                         anno_page_id=f"{base_url}/page/v4/1")

print(manifest.json(indent=2))