Skip to content
Snippets Groups Projects
Commit ea21921d authored by fauno's avatar fauno
Browse files

Ahora si!!!

parent f92b3de4
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,11 @@ ...@@ -3,6 +3,11 @@
file = ARGV.first file = ARGV.first
exit if not File.exist? file exit if not File.exist? file
# Los temporales tiene un sufijo -tmp
file_tmp = file.gsub(/\.pdf$/, '-tmp.pdf')
# Los definitivos -tmp-imposed
file_imp = file.gsub(/\.pdf$/, '-tmp-imposed.pdf')
# Cantidad de páginas # Cantidad de páginas
pages = `pdfinfo '#{file}' | grep '^Pages:' | cut -d: -f2 | tr -d ' '`.to_i pages = `pdfinfo '#{file}' | grep '^Pages:' | cut -d: -f2 | tr -d ' '`.to_i
...@@ -28,7 +33,7 @@ pages8 = ((pages4/2+3)/4*4).to_i ...@@ -28,7 +33,7 @@ pages8 = ((pages4/2+3)/4*4).to_i
--suffix imposed \ --suffix imposed \
--no-landscape \ --no-landscape \
--signature #{pages8} \ --signature #{pages8} \
"#{file.gsub /\.pdf$/, '-tmp.pdf'}"` "#{file_tmp}"`
`rm "#{file.gsub /\.pdf$/, '-tmp.pdf'}"` `rm -v "#{file_tmp}"`
`mv "#{file.gsub /\.pdf$/, '-tmp-imposed.pdf'}" "#{file.gsub /-tmp/, ''}"` `mv -v "#{file_imp}" "#{file_imp.gsub /-tmp/, ''}"`
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment