PDF to Microsoft Word File

InvaderSumo

Member
Joined
Apr 25, 2024
Messages
148
Reaction score
16
Credits
1,581
So I wanna start a project, and the project requires me to be able to convert pdf files to microsoft word files.
Does anybody know how i would do that on debian?

an examble would be, lets say i had 1000 pages in the form of a pdf file. But i dont want to use an online service. Id like to be able to install some type of software that allows me to manually convert the pdf to a microsoft word file myself on my debian system. Or do i HAVE to use something like adobe to do this????
 


If you really do have hundreds of these...

Code:
#!/bin/bash
# Specify the input directory containing your PDF files
input_dir="/path/to/your/pdf/files"
# Specify the output directory for the converted DOCX files
output_dir="/path/to/output/directory"
# Loop through each PDF file in the input directory
for pdf_file in "$input_dir"/*.pdf; do
# Extract the filename without extension
base_name=$(basename "$pdf_file" .pdf)

# Convert the PDF to DOCX
libreoffice --infilter="writer_pdf_import" --convert-to docx "$pdf_file" --outdir "$output_dir"

# Rename the output DOCX file
mv "$output_dir/$base_name.docx" "$output_dir/$base_name.docx"
done
echo "Conversion complete!"
 


Top