Skip to content

Configure pdfjs#35

Merged
alepbloyd merged 18 commits intomainfrom
configure-pdfjs
Dec 3, 2025
Merged

Configure pdfjs#35
alepbloyd merged 18 commits intomainfrom
configure-pdfjs

Conversation

@alepbloyd
Copy link
Copy Markdown
Collaborator

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Adds pdfjs viewer for AcademicDocuments. When an AcademicDocument with a pdf format is deposited and processed, the show page for that work should appear with an embedded PDF viewer by default.

Related Tickets & Documents

QA Instructions, Screenshots, Recordings

Run automated test suite, should see 205 examples, 0 failures, 1 pending.

Manual testing:

  • Build and launch containers, attach to rails container, run 'bundle exec rails db:seed'
  • Sign in as admin user (admin@example.com, password is password)
  • Click on "Works", then "Add New Work", and choose "Academic Document" as the work type.
  • Fill in required metadata, check deposit agreement, and attach a PDF file. Click save.
  • You should be redirected to the show page, where you will see a notification that "Your files are being processed by Scholarspace in the background..."
  • Refresh the page after 30 seconds or so (or monitor logs for completion of background work jobs).
  • You should see an interactive PDF viewing panel on the page.

Contrary to how ArchivalDocuments are processed, these works do not get split into component DerivedPage works for IIIF rendering, so you should not have to trigger any jobs in sidekiq and this should run fairly quickly.

Added/updated tests?

  • Yes - added just a basic, 'can we successfully deposit a pdf work through the dashboard' test. Still working on figuring out testing the actual pdfjs rendering.
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

Other notes

  1. On sticking the whole PDFJS directory in /public. There is probably a good way to have PDFJS build with the Docker images, but the example code for PDFJS (https://mozilla.github.io/pdf.js/getting_started/) is based on including the pre-built build in the repository.

  2. This is operating under the general assumption that 'AcademicDocuments' will be PDF files. I have the pdfjs view panel set to conditionally render based on if the representative media is a pdf, so it should be okay to deposit non-pdfs as this work type, but there will not be a viewing panel.

@alepbloyd alepbloyd marked this pull request as draft November 17, 2025 19:25
@alepbloyd alepbloyd marked this pull request as ready for review November 17, 2025 19:47
@alepbloyd
Copy link
Copy Markdown
Collaborator Author

@dolsysmith @maxturer

I need to spend some more time arguing with our testing and CI system, so the test I started for this is also skipped, but I think this should be okay if either of y'all are up for manually testing this with the steps in the PR.

Copy link
Copy Markdown
Contributor

@dolsysmith dolsysmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PDF is rendered correctly and viewer behaves as expected.

@alepbloyd alepbloyd merged commit 5d83a50 into main Dec 3, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configure pdfjs for AcademicWorks

2 participants