algoo / preview-generator

generates previews of files with cache management
https://pypi.org/project/preview-generator/
MIT License
224 stars 49 forks source link

Feat/192 poppler based pdf builder #275

Closed inkhey closed 2 years ago

inkhey commented 2 years ago

related to #192

PR Goal

Use Poppler-utils command line instead of Pypdf2 and qpdf to get proper pdf preview Goals are:

Implemented solution

Checkpoints

raphj commented 2 years ago

I don't have any opinion or particular insight on on this, I trust you to make the right call here.

Le 19/11/2021 à 15:28, inkhey a écrit :

@.**** commented on this pull request.


In preview_generator/preview/builder/pdf__poppler_utils.py https://github.com/algoo/preview-generator/pull/275#discussion_r753236559:

  • TODO - G.M - 2021-10-21 - Reintroduce caching here ?

  • lines = check_output(["pdfinfo", file_path], stderr=STDOUT, universal_newlines=True).split(
  • "\n"
  • )
  • for line in lines:
  • section, data = line.split(":", maxsplit=1)
  • if section == "Pages":
  • return int(data.strip())
  • FIXME - G.M - 2021-10-21 - Better default case ?

  • return 0

@grignards https://github.com/grignards @raphj https://github.com/raphj This code replace the old code that does use a cached file. I'm not really such we do really improve performance between running pdfinfo command line or opening a cached file that store the number of page provided a first time by pdfinfo. Did you think i should restore the previous behavior here or not ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/algoo/preview-generator/pull/275#pullrequestreview-811275435, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5D7FN6EXMTFXKXPB6CHRDUMZNKLANCNFSM5GOLKV6A. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.