|
|
878a2b |
#!/bin/bash
|
|
|
878a2b |
#
|
|
|
878a2b |
# docbook_convertToPdfFromXml.sh -- This function transforms DocBook
|
|
|
878a2b |
# files which have set the XML DTD in them. To produce PDF from
|
|
|
878a2b |
|
|
|
878a2b |
# command) to produce formatting objects (FO), which then must be
|
|
|
878a2b |
|
|
|
878a2b |
# which uses PassiveTex) to produce the PDF output.
|
|
|
878a2b |
#
|
|
|
878a2b |
# In this configuration and using default configuration settings, I've
|
|
|
878a2b |
|
|
|
878a2b |
#
|
|
|
819c26 |
|
|
|
819c26 |
# whole page-body. They seem to be rendered in a reduced width (1 inch
|
|
|
819c26 |
|
|
|
819c26 |
|
|
|
819c26 |
|
|
|
819c26 |
# `header.column.widths' and `page.margin.top' but it seems to be not
|
|
|
819c26 |
# there where I need to touch.
|
|
|
878a2b |
#
|
|
|
878a2b |
# 2. TOC's indentation is not rendered. Even the `toc.indent.width'
|
|
|
878a2b |
# property is set to 24 by default.
|
|
|
878a2b |
#
|
|
|
819c26 |
|
|
|
819c26 |
# seems to work for the first line only. All other lines in the same
|
|
|
819c26 |
|
|
|
878a2b |
#
|
|
|
878a2b |
|
|
|
878a2b |
# Even the `hyphenate' property is set to `true' by default.
|
|
|
878a2b |
#
|
|
|
878a2b |
# In this configuration and using default configuration settings, I've
|
|
|
878a2b |
|
|
|
878a2b |
#
|
|
|
878a2b |
# 1. It is possible to produce localized PDF outputs through
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
#
|
|
|
878a2b |
|
|
|
878a2b |
# created for intermediate works and final files are moved then to
|
|
|
878a2b |
# their final location.
|
|
|
878a2b |
#
|
|
|
e6bbbf |
# Copyright (C) 2009-2013 The CentOS Project
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is free software; you can redistribute it and/or modify
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
#
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
# General Public License for more details.
|
|
|
878a2b |
#
|
|
|
878a2b |
|
|
|
878a2b |
# along with this program; if not, write to the Free Software
|
|
|
878a2b |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
878a2b |
#
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
# $Id$
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
|
|
|
878a2b |
function docbook_convertToPdfFromXml {
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
054a5f |
cli_printMessage "${FILE}.pdf" --as-creating-line
|
|
|
878a2b |
|
|
|
878a2b |
local -a STYLE_TEMPLATE
|
|
|
878a2b |
local -a STYLE_INSTANCE
|
|
|
878a2b |
local STYLE_INSTANCE_FINAL=''
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
local SRC=${INSTANCE}
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
054a5f |
local DST="${FILE}.pdf"
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
054a5f |
local FO=$(echo ${INSTANCE} | sed -r 's/docbook$/fo/g')
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
054a5f |
local PDF=$(echo ${INSTANCE} | sed -r 's/docbook$/pdf/g')
|
|
|
878a2b |
|
|
|
878a2b |
|
|
|
baa898 |
docbook_prepareStyles "${DOCBOOK_XSL}/docbook2fo.xsl"
|
|
|
878a2b |
|
|
|
054a5f |
|
|
|
1be59e |
|
|
|
1be59e |
|
|
|
819c26 |
ln -sf ${TCAR_WORKDIR}/Identity/Images/Webenv $(dirname ${INSTANCE})/Images
|
|
|
878a2b |
|
|
|
819c26 |
# Create formatting object suppressing output from stderr.
|
|
|
9b787f |
xsltproc --output ${FO} ${STYLE_INSTANCE_FINAL} ${SRC} 2> /dev/null
|
|
|
878a2b |
|
|
|
054a5f |
|
|
|
054a5f |
|
|
|
054a5f |
|
|
|
054a5f |
|
|
|
054a5f |
|
|
|
878a2b |
if [[ $? -eq 0 ]];then
|
|
|
054a5f |
pushd $(dirname ${INSTANCE}) > /dev/null
|
|
|
054a5f |
xmlto -o $(dirname ${FILE}) pdf ${FO}
|
|
|
054a5f |
popd > /dev/null
|
|
|
878a2b |
else
|
|
|
878a2b |
cli_printMessage "`gettext "Cannot produce the PDF file."`" --as-error-line
|
|
|
878a2b |
fi
|
|
|
878a2b |
|
|
|
878a2b |
}
|