Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Control over loading linearized PDFs #67

Open
@glorat

Description

@glorat

I have PDFs as large as 1GB on my platform but I have ensured they are "linearized". With your viewer:

  • The viewer seems to be trying to load the whole file before attempting rendering
    • Pdf.js does support range requests but may need some configuring on your end
  • If I try to load a PDF by assigning the :url but then “cancel” by unmounting the PDF viewer, the download continues in the background
    • That could mean the client sucking up the bandwidth without even realizing!

To address the first point, I recommend exposing props like

  • disableAutoFetch
  • disableStream
  • rangeChunkSize
    which can get passed to pdfjs.getDocument and I can override these to not load the whole document unless needed.
    You may still need to be careful on loading page by page both in canvas and the thumbnail strip - I don't know if your viewer always renders all pages in advance.

To address the second point, pdfjs.getDocument returns a loading that can be cancelled on events unlike unmount

I've successfully tested this approach with this codehttps://github.com/Brief-Tech-Pte/localdoctools/tree/main/src/components/pdf-viewer albeit this is using pdf.js v5 and I think you guys are on v4.

This capability can be tested by loading a synthetic 100 page 50MB PDF and observing the viewer on loads what is required to view the pages being rendered. The linked repo above has this test case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp