• Robert Knight's avatar
    Support fixed layout / PDF-based books in VitalSource integration · 4b2dc699
    Robert Knight authored
    Support VitalSource books which are created from PDFs rather than EPUBs.
    These books have the same frame structure as EPUBs, but use one HTML
    page per PDF page in the inner frame, rather than one HTML page per
    chapter as is more common for EPUBs.
    
    VS PDFs do not contain a selectable text layer. Instead they consist of
    a high-resolution rendered image of the current page plus data about the
    content and location of text characters embedded in a script tag in the
    page which sets a `window.innerPageData` variable.
    
    To support this in Hypothesis, we generate a hidden text layer from the
    `innerPageData` data and overlay it on top of the rendered image. This
    hidden text layer is similar to what PDF.js creates for us in our
    standard PDF viewer.
    4b2dc699
vitalsource-test.js 8.68 KB