dulibrarytech / digitaldu-frontend

Digital Collections DU front end
Apache License 2.0
3 stars 0 forks source link

pdf size workarounds #353

Closed kimpham54 closed 3 years ago

kimpham54 commented 3 years ago
kimpham54 commented 3 years ago

from iiif: Hey all! Any feedback is welcome here, we’re trying to rendering PDFs into our UniversalViewer and are experiencing long load times, we don’t think it has anything to do with the viewer because when we try to download the pdf from source directly (we use duracloud) it takes just as long to load. Does anyone have experience with making pdfs load faster in your iiif viewer? We are thinking about caching pdfs, so making a second version of pdf that’s a smaller size specifically for the viewer - if you do that any recommendations for tools?

jrynhart commented 3 years ago

We can update IIIF manifest to render pdf pages. Need to pass in "page" url parameter with page number value. UniversalViewer does not show controls to move on to the next page of the PDF when done this way, it just shows the current page requested as an image

  1. Look into UV config settings to see if it is possible to enable pagination of PDF page images within a PDF file
  2. If there is no way to do #1 then implement a paginator form and append it to the UV content. The form would control the "page" value in the current UV source url
jrynhart commented 3 years ago

If the IIIF manifest contains a canvas for each page in the PDF, UniversalViewer will render the pagination controls, and load only a single page of the pdf for each canvas.

Each canvas should contain an image object including the resource url along with the the "page" parameter, one canvas for each page in the pdf

Need to determine or know the number of pages in the pdf when the IIIF manifest is generated.

  1. Use pdf library to get page count of file (File would need to be fetched remotely. This should still cause a delay for larger pdfs)
  2. Store the page count in the Elastic index? Can that page count be determined on the back end upon ingesting a pdf?
jrynhart commented 3 years ago

Integrated the pdf page count into the manifest data object #353 Added a function to IIIF manifest generator to create multiple canvases for a pdf file and show one page from the pdf on each canvas #353 Updated the IIIF manifest to display a collection of manifests for a compound pdf object and enable manifest generation for individual compound object parts #353 Updated the IIIF thumbnail on click events and index link click events to update the pdf page thumbnail urls and the download object url #353

jrynhart commented 3 years ago

Summary of updates:

  1. Implemented a function to count the number of pages in a pdf object, for the generation of a multi page pdf manifest
  2. Updated the IIIF manifest generator with a 'paged pdf' function, to create a manifest with multiple canvasses for the pdf pages
  3. Updated the IIIF manifest generator to create manifests for compound object parts
  4. Updated the IIIF manifest generator to create a manifest "list" for compound pdf objects that will be displayed as paged
  5. Updated the universalviewer to display pdf pages in the thumbnails section
  6. Updated the universalviewer index links section to navigate the manifests in the manifest list correctly for our instance
  7. Updated the file download form to work with the above universalviewer changes above