Giter Club home page Giter Club logo

Comments (15)

Belval avatar Belval commented on July 29, 2024 1

If you just want a specific page there are the first_page and last_page parameters. As for the output_folder, you really want to use a tempfile.NamedDirectory to ensure that the files get cleaned up afterwards.

from pdf2image.

Belval avatar Belval commented on July 29, 2024

From the top of my head, at that size, you want to make sure that your are using an output_folder and that your format is not ppm.

I'll make a test case on my side as I have never tested more than 500 pages.

from pdf2image.

Belval avatar Belval commented on July 29, 2024

Just tested with a 2368 pages PDF. If you allow for enough open file handle it does not seem to cause any issue on Ubuntu Server 18.04.

from pdf2image.

vinayakarannil avatar vinayakarannil commented on July 29, 2024

please may i know, what change i should make in my linux system to allow enough file handle?

from pdf2image.

Belval avatar Belval commented on July 29, 2024

On my system, I was able to simply ulimit -n 70000 to make it work.

You might want to make sure that this will persist between reboots.

from pdf2image.

vinayakarannil avatar vinayakarannil commented on July 29, 2024

I made it to 70000 as you said...still no chance . Can you try with this one
https://drive.google.com/file/d/13Srl0JfQ-ZCKGnf95ZxFu0JdeH2P9igx/view?usp=sharing

from pdf2image.

munikarmanish avatar munikarmanish commented on July 29, 2024

I'm getting this issue even with a PDF with less than 200 pages (less than 500 KiB).

@Belval is it possible to return the list of images as a generator instead (if that would solve this issue)?

Basically, I just want the image of one page and convert_from_path(path)[0] is freezing my computer.

Edit: Tried the output_folder="/tmp" and fmt="jpg" parameter as suggested above and now my computer doesn't freeze. That's okay. But I need to manage all the unnecessary files generated. It would have been great if that was handled by pdf2image itself. πŸ™‚

from pdf2image.

Belval avatar Belval commented on July 29, 2024

As for why the generated images are not handled by pdf2image, that's because of how Pillow handles images. You see, when you do Image.open(), the image is just lazy-loaded until you actually use it. If pdf2image cleaned the temp directory, the image converted would become unusable.

from pdf2image.

munikarmanish avatar munikarmanish commented on July 29, 2024

Ah, I see. No problem. I used tempfile.TemporaryDirectory as you suggested and it's working fine. πŸ‘ πŸ˜ƒ

Just out of curiosity, would it be possible to return a generator instead of all pages at once?

from pdf2image.

Belval avatar Belval commented on July 29, 2024

Unfortunately no, as pdftoppm returns all pages at once and this is just a thin wrapper with added multithreading.

from pdf2image.

maheshk3176 avatar maheshk3176 commented on July 29, 2024

I am unable to open the pdf with 2nd password.

from pdf2image.

shang6107 avatar shang6107 commented on July 29, 2024

I just try to convert a pdf file less than 50 pages to jpg, there are no jpg files output also, but png. what should i do

from pdf2image.

shang6107 avatar shang6107 commented on July 29, 2024

By the way, pdf2image's version is 1.6, and what version of poppler is better?

from pdf2image.

Belval avatar Belval commented on July 29, 2024

This issue is now pretty old and a lot have changed since it was originally opened. Feel free to open another issue if you still have issues with PDFs that have a lot of pages.

from pdf2image.

levkany avatar levkany commented on July 29, 2024

anyone managed to solve the issue with large pdfs with a lot of pages?
i am trying to loop each page so generator would be a good solution.

anyone figured it out?

from pdf2image.

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.