I'm sorry to learn that you find overkill the way we implemented 
conversion to PDF.

In fact, we didn't find any other way to do it which also solves the 2 
following problems:

[1] Be able to convert XML documents stored on a remote server (FTP, 
WebDAV, etc).

[2] Conversion to PDF should work even when XXE is deployed using Java 
Web Start (everything is contained in .jar files cached by Java Web Start).

However, I see that you managed to customize XXE to your taste and to 
your needs. And for us, that's a great achievement!


---
PS: for your information, the fop.jar included in the FOP1 add-on has 
been modified by us. You'll find a description of what we did in 
FOP1_addon_installdir/CHANGES_MADE_BY_XMLMIND.txt.




Adam Strzelecki wrote:
> 
> I recently focused on using internal DocBook->FO routines in XXE, as I 
> normally use built in scripts, and I think that XXE is doing way to much 
> with all this copying image files, callouts, etc.
> I think all of this is unnecessary.
> 
> 1) Temporary FO (.fo) file can be created next to existing DocBook file 
> (we don't really need to copy all into /tmp)
> 2) Embedded graphics doesn't need to be copied! It is simply enough to 
> set CWD to folder where DocBook file resides, as FOP is taking CWD when 
> inserting relative paths
> 3) Callout graphics doesn't need to be copied as well, its path can be 
> set dynamically with "admon.graphics.path" relative to DocBook installation
> 
> All of this slows down the conversion process, also makes problematic 
> also using SVG admon graphics.
> 
> I'm attaching my batch scripts you may find useful:
> - config.xml - FOP config
> - db2pdf + db2pdf.bat - Unix & Windows version of script using xsltproc 
> and fop to make PDF
> - db2pdf.xsl - XSL configuration file for DocBook XSL
> 
> Maybe you find them inspiring ;P
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version="1.0"?>
> 
> <!--
> 
> This is an example configuration file for FOP.
> This file contains the same settings as the default values
> and will have no effect if used unchanged.
> 
> Relative config url's will be resolved relative to
> the location of this file.
> 
> -->
> 
> <!-- NOTE: This is the version of the configuration -->
> <fop version="1.0">
> 
>       <!-- Base URL for resolving relative URLs -->
>       <base>.</base>
> 
>       <!-- Source resolution in dpi (dots/pixels per inch) for determining 
> the size of pixels in SVG and bitmap images, default: 72dpi -->
>       <!-- <source-resolution>96</source-resolution> -->
>       <!-- Target resolution in dpi (dots/pixels per inch) for specifying the 
> target resolution for generated bitmaps, default: 72dpi -->
>       <!-- <target-resolution>72</target-resolution> -->
> 
>       <!-- Default page-height and page-width, in case
>                value is specified as auto -->
>       <default-page-settings height="11in" width="8.26in"/>
> 
>       <!-- Information for specific renderers -->
>       <!-- Uses renderer mime type for renderers -->
>       <renderers>
>               <renderer mime="application/pdf">
>                       <filterList>
>                               <!-- provides compression using zlib flate 
> (default is on) -->
>                               <value>flate</value>
> 
>                               <!-- encodes binary data into printable ascii 
> characters (default off)
>                                        This provides about a 4:5 expansion of 
> data size -->
>                               <!-- <value>ascii-85</value> -->
> 
>                               <!-- encodes binary data with hex 
> representation (default off)
>                                        This filter is not recommended as it 
> doubles the data size -->
>                               <!-- <value>ascii-hex</value> -->
>                       </filterList>
> 
>                       <fonts>
>                               <!-- embedded fonts -->
>                               <!--
>                               This information must exactly match the font 
> specified
>                               in the fo file. Otherwise it will use a default 
> font.
> 
>                               For example,
>                               <fo:inline font-family="Arial" 
> font-weight="bold" font-style="normal">
>                                               Arial-normal-normal font
>                               </fo:inline>
>                               for the font triplet specified by:
>                               <font-triplet name="Arial" style="normal" 
> weight="bold"/>
> 
>                               If you do not want to embed the font in the pdf 
> document
>                               then do not include the "embed-url" attribute.
>                               The font will be needed where the document is 
> viewed
>                               for it to be displayed properly.
> 
>                               possible styles: normal | italic | oblique | 
> backslant
>                               possible weights: normal | bold | 100 | 200 | 
> 300 | 400
>                                                                               
>                         | 500 | 600 | 700 | 800 | 900
>                               (normal = 400, bold = 700)
>                               -->
> 
>                               <!--
>                               <font metrics-url="arial.xml" kerning="yes" 
> embed-url="arial.ttf">
>                                       <font-triplet name="Arial" 
> style="normal" weight="normal"/>
>                                       <font-triplet name="ArialMT" 
> style="normal" weight="normal"/>
>                               </font>
>                               <font metrics-url="arialb.xml" kerning="yes" 
> embed-url="arialb.ttf">
>                                       <font-triplet name="Arial" 
> style="normal" weight="bold"/>
>                                       <font-triplet name="ArialMT" 
> style="normal" weight="bold"/>
>                               </font>
>                               -->
>                               <!-- Palatino Linotype -->
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/pala.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/pala.ttf">
>                                       <font-triplet name="Palatino Linotype" 
> style="normal" weight="normal"/>
>                               </font>
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/palab.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/palab.ttf">
>                                       <font-triplet name="Palatino Linotype" 
> style="normal" weight="bold"/>
>                               </font>
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/palabi.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/palabi.ttf">
>                                       <font-triplet name="Palatino Linotype" 
> style="italic" weight="bold"/>
>                               </font>
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/palai.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/palai.ttf">
>                                       <font-triplet name="Palatino Linotype" 
> style="italic" weight="normal"/>
>                               </font>
>                               <!-- Courier New -->
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/cour.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/cour.ttf">
>                                       <font-triplet name="Courier New" 
> style="normal" weight="normal"/>
>                               </font>
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/courb.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/courb.ttf">
>                                       <font-triplet name="Courier New" 
> style="normal" weight="bold"/>
>                               </font>
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/courbi.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/courbi.ttf">
>                                       <font-triplet name="Courier New" 
> style="italic" weight="bold"/>
>                               </font>
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/couri.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/couri.ttf">
>                                       <font-triplet name="Courier New" 
> style="italic" weight="normal"/>
>                               </font>
>                               <!-- Arial -->
>                               <!--
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/arial.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/arial.ttf">
>                                       <font-triplet name="Arial" 
> style="normal" weight="normal"/>
>                               </font>
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/arialbd.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/arialbd.ttf">
>                                       <font-triplet name="Arial" 
> style="normal" weight="bold"/>
>                               </font>
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/arialbi.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/arialbi.ttf">
>                                       <font-triplet name="Arial" 
> style="italic" weight="bold"/>
>                               </font>
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/ariali.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/ariali.ttf">
>                                       <font-triplet name="Arial" 
> style="italic" weight="normal"/>
>                               </font>
>                               -->
>                               <!-- Garamond -->
>                               <!--
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/gara.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/gara.ttf">
>                                       <font-triplet name="Garamond" 
> style="normal" weight="normal"/>
>                               </font>
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/garabd.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/garabd.ttf">
>                                       <font-triplet name="Garamond" 
> style="normal" weight="bold"/>
>                                       <font-triplet name="Garamond" 
> style="italic" weight="bold"/>
>                               </font>
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/garait.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/garait.ttf">
>                                       <font-triplet name="Garamond" 
> style="italic" weight="normal"/>
>                               </font>
>                               -->
>                               <!-- Lucida Bright -->
>                               <!--
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/lbrite.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/lbrite.ttf">
>                                               <font-triplet name="Lucida 
> Bright" style="normal" weight="normal"/>
>                               </font>
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/lbrited.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/lbrited.ttf">
>                                               <font-triplet name="Lucida 
> Bright" style="normal" weight="bold"/>
>                               </font>
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/lbritedi.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/lbritedi.ttf">
>                                               <font-triplet name="Lucida 
> Bright" style="italic" weight="bold"/>
>                               </font>
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/lbritei.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/lbritei.ttf">
>                                               <font-triplet name="Lucida 
> Bright" style="italic" weight="normal"/>
>                               </font>
>                               -->
>                               <!-- Georgia -->
>                               <!--
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/georgia.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/georgia.ttf">
>                                               <font-triplet name="Georgia" 
> style="normal" weight="normal"/>
>                               </font>
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/georgiab.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/georgiab.ttf">
>                                               <font-triplet name="Georgia" 
> style="normal" weight="bold"/>
>                               </font>
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/georgiaz.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/georgiaz.ttf">
>                                               <font-triplet name="Georgia" 
> style="italic" weight="bold"/>
>                               </font>
>                               <font 
> metrics-url="file:///usr/local/docbook/fonts/georgiai.xml" kerning="yes" 
> embed-url="file:///usr/local/docbook/fonts/georgiai.ttf">
>                                               <font-triplet name="Georgia" 
> style="italic" weight="normal"/>
>                               </font>
>                               -->
>                       </fonts>
> 
>                       <xmlHandler mime="text/svg+xml">
>                       </xmlHandler>
> 
>               </renderer>
> 
>               <renderer mime="application/postscript">
>                       <xmlHandler mime="image/svg+xml">
>                       </xmlHandler>
>               </renderer>
> 
>               <renderer mime="application/vnd.hp-PCL">
>               </renderer>
> 
>               <!-- MIF does not have a renderer
>               <renderer mime="application/vnd.mif">
>               </renderer>
>               -->
> 
>               <renderer mime="image/svg+xml">
>                       <format type="paginated"/>
>                       <link value="true"/>
>                       <strokeText value="false"/>
>               </renderer>
> 
>               <renderer mime="application/awt">
>               </renderer>
> 
>               <renderer mime="text/xml">
>               </renderer>
> 
>               <!-- RTF does not have a renderer
>               <renderer mime="text/rtf">
>               </renderer>
>               -->
> 
>               <renderer mime="text/plain">
>                       <pageSize columns="80"/>
>               </renderer>
> 
>       </renderers>
> 
> </fop>
> 



> Hi,
> 
> Here's my complete recipe for customization of DocBook style-sheets, together 
> with FOP customization and enabling automatic system fonts.
> 
> RECIPE
> ------
> 
> 1) In order to TTF font-cache generation work with FOP1 addon, you need to 
> download latest fop-0.9x nightly build and replace all *.jar files except 
> fop1_foprocessor.jar in addon/fop1_foprocessor with the ones found in the 
> nightly, especially don't forget about Xalan.jar which is missing in FOP1 
> addon, but it is required for FOP to generate properly font-cache.
> 
> 2) Create following files in .xxe (or %USERPROFILE%\Application 
> Data\XMLmind\XMLEditor in Windows)
> 
> .xxe/addon/customize.xxe
> 
>> <?xml version="1.0" encoding="UTF-8"?>
>> <cfg:configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
>> xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
>> xmlns:cfg="http://www.xmlmind.com/xmleditor/schema/configuration";>
>>     <cfg:property name="docb.toPS.transform" 
>> url="true">docbook-pdf.xsl</cfg:property>
>>     <cfg:parameterGroup name="docb.toPS.FOPParameters">
>>         <!-- Enable me in Windows <cfg:parameter 
>> name="configuration">%H\Application 
>> Data\XMLmind\XMLEditor\addon\fop-config.xml</cfg:parameter> -->
>>         <cfg:parameter 
>> name="configuration">%H/.xxe/addon/fop-config.xml</cfg:parameter>
>>     </cfg:parameterGroup>
>> </cfg:configuration>
> 
> .xxe/addon/docbook-pdf.xsl
> 
>> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
>> version='1.0'>
>>     <xsl:import href="xxe-config:docbook/xsl/fo/docbook.xsl"/>
>>     <xsl:param name="admon.graphics.path" 
>> select="'xxe-config:docbook/xsl/images/'"/>
>>     <xsl:param name="callout.graphics.path" 
>> select="'xxe-config:docbook/images/callouts/'"/>
>>     <xsl:param name="body.font.family" select="'TimesNewRoman'"/>
>>     <xsl:param name="title.font.family" select="'TimesNewRoman'"/>
>>     <xsl:param name="dingbat.font.family" select="'TimesNewRoman'"/>
>>     <xsl:param name="sans.font.family" select="'TimesNewRoman'"/>
>>     <xsl:param name="monospace.font.family" select="'CourierNew'"/>
>>     <xsl:param name="shade.verbatim" select="1"/>
>>     <xsl:param name="fop1.extensions" select="1"/>
>>     <xsl:param name="draft.watermark.image" select="''"/>
>>     <xsl:param name="header.column.widths">1 8 1</xsl:param>
>>     <xsl:param name="footer.column.widths">1 6 1</xsl:param>
>>     <xsl:param name="admon.graphics" select="1"/>
>>     <xsl:param name="admon.textlabel" select="0"/>
>>     <xsl:param name="admon.graphics.extension" select="'.svg'"/>
>> </xsl:stylesheet>
> 
> 
> .xxe/addon/fop-config.xml
> 
>> <?xml version="1.0"?>
>> <fop version="1.0">
>>     <base>.</base>
>>     <default-page-settings height="11in" width="8.26in"/>
>>     <renderers>
>>         <renderer mime="application/pdf">
>>             <filterList>
>>                 <value>flate</value>
>>             </filterList>
>>             <fonts>
>>                 <auto-detect/>
>>             </fonts>
>>             <xmlHandler mime="text/svg+xml">
>>             </xmlHandler>
>>         </renderer>
>>         <renderer mime="application/postscript">
>>             <xmlHandler mime="image/svg+xml">
>>             </xmlHandler>
>>         </renderer>
>>         <renderer mime="application/vnd.hp-PCL">
>>         </renderer>
>>         <renderer mime="image/svg+xml">
>>             <format type="paginated"/>
>>             <link value="true"/>
>>             <strokeText value="false"/>
>>         </renderer>
>>         <renderer mime="application/awt">
>>         </renderer>
>>         <renderer mime="text/xml">
>>         </renderer>
>>         <renderer mime="text/plain">
>>             <pageSize columns="80"/>
>>         </renderer>
>>     </renderers>
>> </fop>
> 
> 3) Adjust fonts in docbook-pdf.xsl so they're matching your need and existing 
> ones, adjust customize.xxe so it is matching you XXE user profile.
> 
> After 1st run FOP should create .fop/fop-font.cache in your home folder.
> 
> CONCLUSIONS
> -----------
> 
> 1) XXE shouldn't copy any callouts or admon graphics, but instead 
> automatically set "admon.graphics.path" to "'xxe-config:docbook/xsl/images/'" 
> and "callout.graphics.path" to "'xxe-config:docbook/images/callouts/'". (Here 
> I do it manually & this saves space & time)
> 
> 2) XXE shouldn't copy also any document related graphics, but rather set 
> current working directory to place where document resides, so all paths for 
> FOP should be OK. (This saves space & time)
> Only temporary file should be actually .fo tile (or additionally in case or 
> ftp://, http:// output a PDF file).
> 
> 3) Files & paths specified in .xxe/addon/customize.xxe should be relative to 
> .xxe/addon/customize.xxe but they're not in all cases, <cfg:parameter 
> name="configuration"> is relative to /Applications on my Mac and C:\Program 
> Files\XXE\bin on Windows (I think this is a bug)
> 

Reply via email to