#!/bin/bash
# lastact: arturo@2024-02-13
# desc: Convierte un archivo de libreoffice (writer, calc, impress) to pdf

FICHFUNCS="/usr/bin/vx-funcs-bash"
[ -f "${FICHFUNCS}" ] && . "${FICHFUNCS}" "null"

TITULO="Herramienta de conversión de documentos a PDF"
ICONO="vitalinux"
IMAGEN="pdf"

if (( ${#} < 1 )) ; then
    TITULO="Error en la llamada al programa"
    TEXTO="Debes Introducir al menos un parámetro: la ruta del documento ofimático a convertir a PDF"
    vx-mensaje_y_salir "${TITULO}" "${TEXTO}" "1" "info" "salir"
fi

(
    /usr/bin/vx-libreoffice-to-pdf-cli "${@}"
) | yad --title "${TITULO}" \
--window-icon "${ICONO}" \
--image "${IMAGEN}" \
--width 600 \
--center \
--progress --pulsate --button="Cerrar":0

exit 0