Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature req: restore wildcards, empty [outfile]= reuse filename with new extension #53

Closed
rcrath opened this issue Dec 5, 2022 · 2 comments

Comments

@rcrath
Copy link

rcrath commented Dec 5, 2022

Hi, thanks for modernizing unoconv. I have a script that I need for my work that I used to be able to run on unoconv. unoconv no longer works because of deprecation of distutils. unoconverter does not yet have the features I need to keep my work up to date.

I can get unoconvert to run, but I lose the ability to input wildcards for infile and output the same names to outfile with a new extension. The command in unoconv:

unoconv -f pdf -e SelectPdfVersion=1 -e ExportNotes=false '*.odt' 

gives error

/usr/bin/unoconv:860: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if product.ooName not in ('LibreOffice', 'LOdev') or LooseVersion(product.ooSetupVersion) <= LooseVersion('3.3'):

Thanks for your consideration.
Using Manjaro 21.3 Cinnamon, 5.42, libreoffice fresh 7.4.2-2

@rcrath
Copy link
Author

rcrath commented Dec 5, 2022

This is my workaround which I might just keep and retire the uno* apps. I'm only doing a few dozen files at a time, so the efficiency is not really a factor.

#!/bin/bash 
#this set of commenting is all relevant to the broken unoconv command.
#echo "If you recieve \"Error: Unable to connect or start own listener\"  Just 
#run the command again. If you get pyuno bridge error try running \"pip 
#install unotools\""

#put this bash script in the same folder as the odt files 
# you want to make pdf from. it will safely convert all of them
#create a folder in current directory with current date
mkdir -p $(date +%y%m%d)
# copy all odt files from current directory to the dated one just created and enter the folder
cp *.odt $(date +%y%m%d)
cd $(date +%y%m%d)

These are just the unoconv* commands, ignore.
#unoconv -f pdf -e SelectPdfVersion=1 -e ExportNotes=false '*.odt' 
# unoserver --daemon
# unoconvert --convert-to pdf *.odt -

# loop through all the odt files in the dated folder and 
# cconvert them to pdf, leaving the originals intact. 
for f in .*.odt
do
	echo "converting $f to pdf"
	soffice --headless --convert-to pdf *.odt
done

# go up to the folder the script is in, create a folder called pdf if 
# it is not already there, and copy the pdf files into a subfolder 
# of the pdf named with the current date.  
mkdir -p ../pdf/$(date +%y%m%d)
mv *.pdf ../pdf/$(date +%y%m%d)
cd ..
# delete the temprorary dated folder 
rm -R $(date +%y%m%d)

@regebro
Copy link
Member

regebro commented Dec 5, 2022 via email

@regebro regebro closed this as completed Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants