• One of the issues I have with PDFs is they typically are rendered by the browser. Those that do use a JS renderer (PDF.js, Google Docs etc), typically embed the PDF in a page or post. I have hundreds of PDFs many with “many” pages. Embedding them is not an option as it takes a page many minutes to load. If I simply thumbnail the PDFs Im still left with the Browser rendering which also takes ages…
    What I was hoping to do was to thumbnail the PDFS and then link it to “new page”. This obviously will take me to https://mydomain/wp-contents/uploads/YYYY/MM/document.pdf As Im using PDFjs I want to prefix the URL with /pdfjs/web/viewer.php?file=
    This would then force the PDF to open with the JS renderer which is not only fast, but also gives me navigation, print, full screan, download, scroll and all the usual “features”, where currently my users are at the mercy of whatever browser they use (the worst of which is any of the Android browsers that merely download the PDF.)
    What I would like to know, is, where is the code that concats server names and paths and file names to generate the URL. It is that piece of code that I need to append to add the PDF.js rendering.
    Thanks
    GRI2a

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Thread Starter gri2a

    (@gri2a)

    Steven,
    Thanks for your reply. Ive looked at the pdfjs viewer shortcode plugin. Unfortunately it (and all other PDFview plugins) embed the view in a page for all PDFs. I want to thumbnail PDFS and ONLY call PDFjs to open the selected PDF.
    The prob with most PDF plugins is the fall into 2 classes. Those that have good rendering capabilities also embed the PDFs, which means they are slow to load pages and fast to render the individual PDFs. The second type typically thumbnail the PDFs and then leave the rendering to the browser being used which are usually pretty ordinary.
    I will keep looking
    GRI2A

    If you are putting the icon in yourself, you can also put the correct link in yourself.
    WordPress now generates thumbnails for PDFs, so if you are using that, you might need some filter for when the link is generated. See
    get_attachment_link

    Thread Starter gri2a

    (@gri2a)

    Joy,
    Thank you for your response. I have hundreds of PDFs and wont be manually entering thumbnails and URLs.
    Thats why I want to modify the load method of new_window so that any and all PDFs will load with a nominated PDF loader, rather than the one in the user’s browser
    GRI2A

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘PDFs-Native Browser Rendering is too slow’ is closed to new replies.