Skip to content

Make IABookreader respect the IIIF manifest #71

@DiegoPino

Description

@DiegoPino

What is this?

This comes from a google group discussion about making a IIIF manifest that works for a single PDF by using cantaloupe to extract each Page as individual images. See this demo Twig template https://gist.github.com/DiegoPino/724ce3b703f870acb63c3340c7f9d897

When enabling that Twig Templates as a Metadata Display in Archipelago and setting IABookreader to use it, and also assuming you have a PDF ingested in a given ADO, and you also manually added an extra key named "pageCount":7 (e.g) like here, which is needed until beta3 is out..

 "as:document": {
        "urn:uuid:64e52047-0740-41a0-9034-89c244558986": {
            "url": "s3:\/\/827\/application-14388-66424-1-pb-64e52047-0740-41a0-9034-89c244558986.pdf",
            "name": "14388-66424-1-PB.pdf",
            "tags": [],
            "type": "Document",
            "dr:fid": 6,
            "dr:for": "documents",
            "dr:uuid": "64e52047-0740-41a0-9034-89c244558986",
            "checksum": "827187fd60b0d77aa6127fbab4aed663",
            "sequence": 1,
            "pageCount": 7,
            "crypHashFunc": "md5"
        }
    },

You will get same page displayed, in my case 7 times.

Which is strange since the IIIF Manifest generates correctly Resource entries like this one

"resource":{
      "@id": "http://localhost:8183/iiif/2/827%2Fapplication-14388-66424-1-pb-64e52047-0740-41a0-9034-89c244558986.pdf/full/full/0/default.jpg?page=2",

with page varying from 1 to 7 in my case.

So, error is not the IIIF Manifest, but our/my/IA assumption on the JS on how to handle IIIIF V2.

In particular this line

https://github.com/esmero/format_strawberryfield/blob/8.x-1.0-beta3/js/plugin.iiif-iabookreader_strawberry.js#L106

Where instead of trusting the @id in the resource section, we try to be "smarter" and we recreate the call based on the Service ID... which is so good and so bad (good if we have like just images all with actual services, and info.json, etc, but bad for any one writing Manifests manually or needing to use PDF extraction like ourselfs.

Solution. Rewrite that JS to deal with rebuilding the the URL only, and only if, the ID is not already and image. Just sayng

@giancarlobi what do you think? Is my explanation clear?
@mitchellkeaney this is why you see your page twice..

Metadata

Metadata

Labels

bugSomething isn't workingexternal bugIt is not us, it is them

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions