Publican question

Jeff Fearn jfearn at redhat.com
Mon Feb 18 23:23:01 UTC 2008


Hi Jared, we do indeed use FOP 0.20.5, and although I have some configuration data 
I used when testing FOP 0.93, it is by no means complete and I have no idea if 
they work with FOP 0.94.

FWIW I have found FOP 0.20.5 to be significantly more reliable than FOP 0.93, I 
haven't had time to test FOP 0.94 yet :(

Jared Smith wrote:
> On Mon, 2008-02-18 at 09:47 -0500, Jared Smith wrote:
>> I'm sure I'll have more questions later, but I figured I'd throw this
>> one out here -- Is anyone else able to build PDFs using Publican?  I've
>> been playing with it all weekend, but I keep getting errors from FOP
>> when I try to build PDFs.  
> 
> OK, sorry for the noise on the list... I think I've made some pretty
> good progress on tracking down this problem.  To make a long short,
> publican is assuming that we're using FOP 0.20, while what's in rawhide
> is 0.94.  This meant xsltproc was adding fox:destination elements to
> the .fo file, instead of the new fo:bookmarks instead.  To work around
> this problem, I had to pass two additional string parameters to xsltproc
> (in Makefile.templates):
> 
>  --stringparam fop1.extensions 1 --stringparam  fop.extensions 0
> 
> That got the .fo file generated so that FOP 0.94 would handle it
> correctly, but then FOP died complaining that it couldn't find Batik in
> the classpath.  (Which is strange, because I have batik installed.  I'm
> wondering if the version of FOP in rawhide needs to be rebuilt with
> something to tell it to look for batik, but that's just a wild guess.)
> FOP needs batik to render the SVG graphics.  To get around this problem,
> I removed the SVG logo from my document, and I passed one more parameter
> to xsltproc to tell it to use the .png admonition graphics instead of
> the SVG versions:
> 
>  --stringparam admon.graphics.extension .png
> 
> Ah, lo and behold, I was able to render a PDF!
> 
> I'll go ahead and create a diff against Makefile.templates and post it
> to bugzilla tomorrow, but this raises a few questions:
> 
> 1) Do we want the toolchain to be able to detect the version of FOP and
> adjust itself accordingly?

This is probably the best approach, however different versions of FOP require 
different configuration files and font metrics files. So we really want to keep 
the number of supported version to a low number, like say 2 :)

> 2) Do we want to expose other parameters to xsltproc?  In my very
> rudimentary home-grown toolchain, I create a custom XSLT stylesheet that
> exposes a bunch of settings (paper.type, double.sided, draft.mode,
> shade.verbatim, etc.) which imports the standard XSL stylesheet.  Would
> this be more manageable in the long run that passing a bunch of
> stringparam arguments to xsltproc?  

The custom xsl has been specifically modified to give the best layout for the 
targeted formatting. It _may_ break horribly if you change parameters like single 
page and paper size. By "break horribly" I mean it may output ugly things, which 
I'm assured is close to criminal ... Andy likes his pretty things!

The thing about brands is that you don't want people changing things arbitrarily, 
if they want that they need to make their own brand.

The first custom brand will probably be a little difficult, I'll be happy to help 
anyone trying to setup a custom brand to get any kinks worked out.

I think the best way of doing this is to check for Brand specific xsl files, and 
if they exist use them. This way you can guarantee that books built using your 
brand, on your build server, will always be "on brand". But it also allows people 
to make custom brands and change the layout however they want.

If you wanted to offer two different outputs for a single real format, i.e. two 
flavors of pdf, one way would be to make a new main-<format>.xsl file.

e.g. Say you were wrong, yes wrong, and wanted to use US Letter (he he he :P) and 
single page, you could make a new target, say pdf-LS, you just cp main-pdf.xsl to 
main-pdf-LS.xsl, and make your changes to main-pdf-LS.xsl.

The slightly tricky part is to add the extra build targets to the appropriate 
Makefile, and viola you have an easy way of building US Letter, Single Page, PDFs 
(make pdf-LS). This is tricky since it uses Makefile templates, but the actually 
changes are easy once you grok how they work.

This would allow you to heavily customize the pdf-LS output without impacting the 
standards compliant, highly correct, extremely sexy, A4 pdf output ;)

I'll be adding Brand specific Makefiles to allow Brands to customize the build 
process, so this kind of thing will be easier for Brands to do.

> 3) Makefile.templates currently tells FOP to use the fop configuration
> file in $(COMMON_CONFIG)/fop/fop-0.20.5.xconf, but that doesn't come as
> part of the publican package.  Should we remove the reference (and
> assume people have a valid FOP config file in /etc/fop.conf), or expose
> this via a variable in the Makefile?  (This isn't a big deal -- I just
> thought I'd mention it in passing while I was thinking about it.)

It's at /usr/share/publican/fop/fop-0.20.5.xconf

There is also /usr/share/publican/fop/fop-0.93.xconf

The default fop config file lacks font entries, causing most translated PDFs to be 
unreadable.

Definitely need to be able to switch fop config files, I'll poke around to find a 
workable way of doing this.

Cheers, Jeff.




More information about the fedora-docs-list mailing list