Stirling-Tools / Stirling-PDF

#1 Locally hosted web application that allows you to perform various operations on PDF files
https://stirlingpdf.com
MIT License
46.07k stars 3.75k forks source link

0.32.0 - Question about "Removed CLI block on .exe installs..." #2215

Open Info-BC opened 1 day ago

Info-BC commented 1 day ago

Hello,

Regarding 0.32.0 Major Enhancements : Removed CLI block on .exe installs to instead use dependency detection allowing Windows users to use CLI programs if installed

Does this mean, for Windows Stirling-PDF.exe release users (or with-login), that we can now install for example OCRMyPDF and LibreOffice in order to have missing function like compress PDF and convert PDF from or to DOCX, etc. ?

Thanks

dosubot[bot] commented 1 day ago

Hello, @Info-BC! I'm here to help you with any questions or issues you may have. Let's see how I can assist you.

The update in version 0.32.0, which removed the CLI block on .exe installs, allows Windows users to use CLI programs like OCRMyPDF and LibreOffice if they are installed. This means you can indeed install these tools to enable functionalities such as compressing PDFs and converting PDFs to or from DOCX. The dependency detection on Windows is handled by using the where command to check if a command is available, which is part of the ExternalAppDepConfig class [1].

To continue talking to Dosu, mention @dosu.

Frooodle commented 1 day ago

Correct!

Info-BC commented 1 day ago

Ok, so I started with my first missing dependency Ghostscript, I installed the last release Ghostscript 10.04.0 for Windows (64 bit) from the official website, it's in the Windows path as I can run gswin64 in a cmd prompt from any directory.

But after launching Stirling-PDF.exe, in the cmd log I still have the warning for missing GhostScript. Could-you tell me if I have to do another thing?

Thanks

Frooodle commented 1 day ago

It is checking for it to be called gs not gswin It might need different naming for windows This is quite a new usecase for us so might be bugs

If that is the case we can work a fix into next patch

Info-BC commented 1 day ago

To check, I made a copy of the file from C:\Program Files\gs\gs10.04.0\bin\gswin64.exe to C:\Program Files\gs\gs10.04.0\bin\gs.exe - And I don't see the log warning now, I don't know if the exe copy could cause other problems?

I continue with Libreoffice

Frooodle commented 1 day ago

Thanks for checking I have created https://github.com/Stirling-Tools/Stirling-PDF/issues/2216 To address gs naming, let me know for the others!

Info-BC commented 1 day ago

After Libreoffice installed, I had to add C:\Program Files\LibreOffice\program to system's path environment variable, now I have convert from PDF menu, tried a pdf->doc and it's ok.

Info-BC commented 1 day ago

Then for OCRmyPDF, I installed last release of Phyton (there is a tick at the beginning to add to path) and Tesseract (with french as additionnal language) + pip install ocrmypdf

I have the menu for OCR but I can't use it for now, as I am using french, it's written I have to check the documentation to use OCR with other languages or outside Docker.

Info-BC commented 1 day ago

Compress PDF is now also available and works

Info-BC commented 1 day ago

For unoconv, I have downloaded the source, placed on C:\unoconv-0.8.2 and added to the system path variable. No warning anymore, I have the menu File to PDF, but I tried and had error : Error:java.io.IOException: Cannot run program "unoconv": CreateProcess error=2, file missing

For OCRmyPDF, I read the docs but can't find how to make it work, I have the eng + additionnal fr language file at the right place I guess C:\Program Files\Tesseract-OCR\tessdata and added C:\Program Files\Tesseract-OCR in the path but still only the message to check docs (no form for file input and options)

Info-BC commented 1 day ago

For OpenCV, I installed with pip install opencv-python but I still have the warning.

I've just seen that I have 2 python installations because libreoffice has one built-in and I installed another separatly. The first one does not have pip, only the other. So maybe there is something to do with that...

If I launch python.exe from cmd it is the one of libreoffice, via the path system variable. The python installation added to the user path variable ...\Python313\ and ...\Python313\Scripts\ folders

Ludy87 commented 16 hours ago

For OCRmyPDF, I read the docs but can't find how to make it work, I have the eng + additionnal fr language file at the right place I guess C:\Program Files\Tesseract-OCR\tessdata and added C:\Program Files\Tesseract-OCR in the path but still only the message to check docs (no form for file input and options)

Did you also specify the path in the settings.yml?

system:
  tessdataDir: C:\\Program Files\\Tesseract-OCR\\tessdata
Info-BC commented 15 hours ago

Thank you! I modified the path in ...\StirlingPDF\configs\settings.yml and now it works, I have both eng and fr languages.

Frooodle commented 9 hours ago

So to confirm does all above work without issue other than gswin64 needing changing to gs?

Frooodle commented 9 hours ago

we need to add all this info of what you did to https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/Getting%20started/Installation/Local/Windows.md to get it published on our website etc Would be a big help if you could write some of that down in a PR to above file to help others

Info-BC commented 5 hours ago

So to confirm does all above work without issue other than gswin64 needing changing to gs?

These does not work yet :

For unoconv, I have downloaded the source, placed on C:\unoconv-0.8.2 and added to the system path variable. No warning anymore, I have the menu File to PDF, but I tried and had error : Error:java.io.IOException: Cannot run program "unoconv": CreateProcess error=2, file missing

For OpenCV, I installed with pip install opencv-python but I still have the warning.

The two python as mentionned above may be a problem, but I don't know what could be the best way to solve it?

I haven't tested these for now :

Weasyprint​ (found the Windows release but there is some other things to install as I could see) pdftohtml (Could-you tell me where to find this one?)

Info-BC commented 5 hours ago

we need to add all this info of what you did to https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/Getting%20started/Installation/Local/Windows.md to get it published on our website etc Would be a big help if you could write some of that down in a PR to above file to help others

Yes, when everything will be running well, I would be happy to write the steps