libreccm-legacy/ccm-gen-aplaws/doc/docs-stuff/indexedpg-pdf

53 lines
1.3 KiB
Plaintext
Executable File

# Based on original from Eric Bischoff <eric@caldera.de>
# Modified by Tammy Fox <tfox@redhat.com> for Red Hat Documentation
# Convert to TeX
$SGML_JADE -t tex -o ${SGML_FILE_NAME}.tex $SGML_ARGUMENTS
if [ $? -ne 0 ]
then exit 1
fi
# Convert from TeX to DVI
jadetex ${SGML_FILE_NAME}.tex >${SGML_FILE_NAME}.out
if [ $? -ne 0 ]
then
cat ${SGML_FILE_NAME}.out
rm ${SGML_FILE_NAME}.out
rm ${SGML_FILE_NAME}.tex
exit 2
fi
rm ${SGML_FILE_NAME}.out
# If there are unresolved references, re-run jadetex, twice
if egrep '^LaTeX Warning: There were undefined references.$' ${SGML_FILE_NAME}.log >/dev/null 2>&1
then
jadetex ${SGML_FILE_NAME}.tex >/dev/null
jadetex ${SGML_FILE_NAME}.tex >/dev/null
fi
#Keep log file - tfox
#rm ${SGML_FILE_NAME}.log
rm ${SGML_FILE_NAME}.aux
rm ${SGML_FILE_NAME}.tex
echo ${DVI_PAGES}
# Convert from DVI to PostScript
echo -n Converting to PS...
dvips -T 5.49in,8.26in -pp ${DVI_PAGES} -q ${SGML_FILE_NAME}.dvi -o ${SGML_FILE_NAME}-pg${DVI_PAGES}.ps
if [ $? -ne 0 ]
then
# rm ${SGML_FILE_NAME}.dvi
exit 3
fi
#rm ${SGML_FILE_NAME}.dvi
echo Done!
# Convert from PS to PDF
echo -n Converting to PDF...
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sPAPERSIZE=a5 -sOutputFile=${SGML_FILE_NAME}-pg${DVI_PAGES}.pdf ${SGML_FILE_NAME}-pg${DVI_PAGES}.ps
rm ${SGML_FILE_NAME}-pg${DVI_PAGES}.ps
echo Done!
exit 0