Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

I667 install pdfjs #669

Merged
merged 10 commits into from
Nov 23, 2023
Merged

I667 install pdfjs #669

merged 10 commits into from
Nov 23, 2023

Conversation

ShanaLMoore
Copy link
Contributor

@ShanaLMoore ShanaLMoore commented Nov 22, 2023

Co Author: @kirkkwang

Story

This PR installs PDF.js.

The client will have the ability to turn it on/off via a feature flipper switch. When on, the code will also automatically decide when to display the PDF.js. If the work has a pdf with no child works (aka iiif_print failed to split for whatever reason) the viewer will render PDF.js instead of a black UV box.

Additionally, when there is not file download the file served will come from AWS s3 bucket and prioritizes READER.pdf files.

This PR looks big but majority of the files are imported/generated by the PDF.js install. View each commit to get a better idea of code changes, or ignore everything in the public directory.

Refs:

related PR:

TODO/nice to have if we weren't under a time crunch: SPECS for the helper files

Expected Behavior Before Changes

When no child works

example: https://adl.b2.adventistdigitallibrary.org/concern/published_works/20091582_atlantic_union_gleaner_april_22_1957?locale=en

image

Expected Behavior After Changes

When no child works (the PDF.js viewer should display)

  • this is same work in the before section, but after deployed to prod and refreshed 🤩

image

image

When child works exists (the UV should display)

example: https://adl.b2.adventistdigitallibrary.org/concern/published_works/20092576_atlantic_union_gleaner_april_5_1990?locale=en

image

When file set failed to characterize

example on prod: https://adl.b2.adventistdigitallibrary.org/concern/published_works/20091854_atlantic_union_gleaner_september_24_1962
image

Shana Moore added 9 commits November 21, 2023 14:42
This commit will copy over the files from a generic build of PDF.js. The
build was created by running the following commands:

```sh
git clone https://github.com/mozilla/pdf.js.git
cd pdf.js
npm install -g gulp-cli
npm install
gulp generic
```

In the project's build folder we find all the files needed.  We copy
over mostly everything, skipping debug and sandbox files. Also skip the cmaps directory and the demo file.

Issue:
- https://github.com/scientist-softserv/adventist-dl/issues/667
Using the `.mjs` extension did not seem to work properly, however
renaming it to `.js` seems to work fine.  This commit renames instances
(where needed) of `.mjs` to `.js`.
This commit will add a feature flipper to switch between using PDF.js or
Universal Viewer for displaying PDFs.  At the moment we have no
mechanism to turn off IIIF Print PDF processing, however, that was not
indicated as a requirement at this time so that is not included until we
have a need for it.
This commit will add the PDF.js viewer to the work show page. It will
also add a helper method to the work show presenter to determine if the
work has a PDF file.  All relevant views will be updated.
This commit will add a PDF's text to the file set's solr document so it
can be searched in the catalog.  Now we can pass the search term to the
viewer so when it loads it will highlight the search term.
In this commit we update #pdf_viewer? to consider child works. If there are any child works this method should return false.
In this commit, we add logic to display the correct pdf type when using s3 locations. We should use the READER pdf if one exists, if not, default to what's available (which likely will be ARCHIVAL).
@ShanaLMoore ShanaLMoore requested review from laritakr and removed request for laritakr November 22, 2023 21:37
@ShanaLMoore ShanaLMoore marked this pull request as ready for review November 22, 2023 23:22
This commit will add a check for the file set's extension (label)
instead of solely relying on the mime type. This will allow us to know
if it's a PDF (as best as we can anyway) even if CharacterizeJob did not
run.

Also, downgraded the version of simple_form because it was causing
crashes in development.
@laritakr laritakr merged commit 5289af5 into main Nov 23, 2023
8 checks passed
@laritakr laritakr deleted the i667-install-pdfjs branch November 23, 2023 21:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants