Skip to content

Way to render 200+ page pdfs efficiently? #135

Answered by TaTo30
chronicadventure asked this question in Q&A
Discussion options

You must be logged in to vote

I have used Range-Request to achieve a optimal PDF loading.

For example, on one of my projects I have this setup:

const document = ref()

// ...

const { pdf: src, pages: numPages, info } = usePDF(document)

export default function () {
   // composable content
  
   // At some point of the app lifecycle...
   function initLoad () {
     documento.value = {
       url: selectedDocument.value.bytes,
        rangeChunkSize: 1024 ** 2,
        disableStream: true,
        disableAutoFetch: true
      }
   }
}

The server must support Range-Request, here an example using python with werkzeug server:

if stream.mimetype == 'application/pdf':
    headers = [
        ("Content-Type", "application/…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@chronicadventure
Comment options

@TaTo30
Comment options

Answer selected by TaTo30
Comment options

You must be logged in to vote
1 reply
@TaTo30
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #134 on August 17, 2024 21:50.