pptx_to_pdf script
This commit is contained in:
@@ -71,3 +71,13 @@ Questa repository contiene i seguenti script:
|
|||||||
- `pdfcompress` — [@aziis98](https://git.phc.dm.unipi.it/aziis98) (script preso in prestito [da questa repo](https://git.phc.dm.unipi.it/aziis98/chatgpt-scripts/src/branch/main/bin/pdfcompress2))
|
- `pdfcompress` — [@aziis98](https://git.phc.dm.unipi.it/aziis98) (script preso in prestito [da questa repo](https://git.phc.dm.unipi.it/aziis98/chatgpt-scripts/src/branch/main/bin/pdfcompress2))
|
||||||
|
|
||||||
Comprime un PDF vettorizzato (ad esempio note scritte su un iPad) utilizzando poppler (file di ~100MB diventa tranquillamente di ~10MB)
|
Comprime un PDF vettorizzato (ad esempio note scritte su un iPad) utilizzando poppler (file di ~100MB diventa tranquillamente di ~10MB)
|
||||||
|
|
||||||
|
- `pptx_to_pdf` — [@lukefleed](https://git.phc.dm.unipi.it/lukefleed)
|
||||||
|
|
||||||
|
Permette di convertire tutti i file .pptx dentro una cartella in file .pdf. Per utilizzarlo, basta eseguire lo script da terminale nella cartella dove sono presenti i file `.pptx`
|
||||||
|
|
||||||
|
I nuovi file `.pdf `verranno salvati nella cartella `pdf` (che verrà creata automaticamente se non esiste già). Per poter eseguire lo script, è necessario avere installati i seguenti pacchetti (ubuntu):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt install libreoffice default-jre libreoffice-java-common
|
||||||
|
```
|
||||||
|
|||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Create the pdf folder if it doesn't exist
|
||||||
|
mkdir -p pdf
|
||||||
|
|
||||||
|
# Iterate through all .pptx files in the current folder
|
||||||
|
for file in *.pptx; do
|
||||||
|
if [ -f "$file" ]; then
|
||||||
|
# Extract the base name (without extension) of the file
|
||||||
|
base_name=$(basename "$file" .pptx)
|
||||||
|
|
||||||
|
# Convert the .pptx file to .pdf and save it in the pdf folder
|
||||||
|
libreoffice --headless --convert-to pdf --outdir pdf "$file"
|
||||||
|
|
||||||
|
echo "Converted $file to pdf/$base_name.pdf"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Conversion complete!"
|
||||||
|
|
||||||
Reference in New Issue
Block a user