Code Monkey home page Code Monkey logo

Comments (6)

mananapr avatar mananapr commented on July 17, 2024

are you experiencing any lags with your method? AFAIK ranger uses pdftotext for pdf previews so I'll look into it too

from cfiles.

cbosoft avatar cbosoft commented on July 17, 2024

Ranger does use pdftotext as default, but there's a commented out code block in scope.sh in ranger which converts the PDF to image. Looking at it now, ranger uses pdftoppm rather than ghostscript.

It doesn't really lag, ghostscript is quite fast. video

from cfiles.

mananapr avatar mananapr commented on July 17, 2024

Check out the latest release and let me know if you encounter any bugs. I tested it on some small PDF documents and it was responsive. Haven't yet tried with bigger sized PDFs

from cfiles.

cbosoft avatar cbosoft commented on July 17, 2024

I think pdftoppm is somehow inconsistent about the numbering it uses:

screenshot of ls /tmp/prev*

I (mostly) couldn't get a PDF preview. The code expects an image preview to be generated with the name "prev-001.jpg", right? My pdftoppm gives "prev-01.jpg" sometimes:

screenshot of pdftoppm output

However adding the -singlefile option removes the numbering from the output file, resulting in only the extension ".jpg" being added:

screenshot of pdftoppm output2

I wonder why the numbering is sometimes different?

Thanks for putting in the time to add this feature :) However, it's a bit slow, and for some reason, I'm getting the same PDF preview for different files: video

from cfiles.

mananapr avatar mananapr commented on July 17, 2024

Checkout the latest commit. I used the -singlefile option and now I am not getting same previews for different files. The speed is okay for small PDFs but it can take 1-2s for 40+mb PDFs. For this reason I have made it optional in the config. Try the latest commit and let me know how it works for you

from cfiles.

cbosoft avatar cbosoft commented on July 17, 2024

Perfect! Thank you :)

from cfiles.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.