johndoe31415 / pdfminify

PDF minifier that allows removing duplicate data, re-compresses images, creation of PDF/A-1b and digital PDF signing
GNU General Public License v3.0
55 stars 11 forks source link

[Windows 10] Permission denied #17

Open TobiGr opened 1 month ago

TobiGr commented 1 month ago

What is the issue?

I get a permission denied error while trying to minify images in a PDF. The error only happens on Windows 10, there are no problems on Linux (Ubuntu 24.04). The command is executed on a different drive. (not c:). Happens on multiple Win10 instances, test VMs and productive machines.

pdfminify version 0.2.2 llpdf version: 0.0.6-rc0

pdfminify --target-dpi 300 pdf.pdf pdf_compressed.pdf
Traceback (most recent call last):
  File "c:\program files (x86)\python38-32\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\program files (x86)\python38-32\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "c:\users\X\appdata\roaming\python\python38\scripts\pdfminify.exe\__main__.py", line 7, in <module>
  File "C:\Users\X\AppData\Roaming\Python\Python38\site-packages\pdfminify\__main__.py", line 148, in main
    pdf_filter.run()
  File "C:\Users\X\AppData\Roaming\Python\Python38\site-packages\llpdf\filters\DownscaleImageOptimization.py", line 94, in run
    resampled_image = self._rescale_image(image, scale_factor)
  File "C:\Users\X\AppData\Roaming\Python\Python38\site-packages\llpdf\filters\DownscaleImageOptimization.py", line 55, in _rescale_image
    resampled_image = reformatter.reformat(image)
  File "C:\Users\X\AppData\Roaming\Python\Python38\site-packages\llpdf\img\ImageReformatter.py", line 112, in reformat
    reformatted_image = self._reformat_channel(image, lossless)
  File "C:\Users\X\AppData\Roaming\Python\Python38\site-packages\llpdf\img\ImageReformatter.py", line 79, in _reformat_channel
    image.writefile(src_img_file.name)
  File "C:\Users\X\AppData\Roaming\Python\Python38\site-packages\llpdf\img\PDFImage.py", line 197, in writefile
    with open(filename, "wb") as f:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\X\\AppData\\Local\\Temp\\\src_img_k77m5a0q.jpg'

Happens with every file containing an image, e.g. this pdf: pdf.pdf

All Info Provided