Accessing Height And Width Of Epub Book Page #71
Unanswered
sourabhzelus
asked this question in
Q&A
Replies: 1 comment
-
There's no public Readium API that provides the size of a fixed layout resource. You will need to extract it yourself from the resource's HTML viewport meta tag. Here's how we extract this information in JavaScript. If you need to compute the sizes for all resources, you can proceed like this (warning I didn't run this code): let sizes = try publication.readingOrder
.map { publication.get($0).readAsString() }
.flatMap { result in
result.flatMap { html in
// Parse the HTML (with SwiftSoup for example) and extract the sizes using the algorithm linked above.
}
}
.get() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello @mickael-menu
I am developing a Epub reader sample using the readium/swift-toolkit. This sample is being designed to use the UIPageViewController for page curl animation on swipe of book page.
I have been testing my sample with multiple books. Each book has a different height and width. Currently the size of UIPageViewController`s page is fixed. It uses the same value to display a page regardless of the Epub file. My goal is implement an option to dynamically size the UIPageViewController’s Page Size. The requirement is to display the page of any fixed layout Epub book page using the size which the readium/swift-toolkit renders.
How I can get the actual height and width of book page at run time for both Portrait mode and Landscape mode from the readium library, so I can set the UIPageViewController dimensions
Beta Was this translation helpful? Give feedback.
All reactions