[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [publican-list] Patch for setting paper size



Jared Smith wrote:
> I've written a small patch for Publican that allows you to set the paper
> size (A4/US Letter/etc.) from the Makefile generated by Publican.  I've
> attached the patch to bug #495136 in Red Hat's bugzilla[1].
> 
> Since I haven't received any feedback on the patch via the bug tracker,
> I figured I'd post this note to the publican list and see if anyone else
> has any interest in the patch.  I'm completely open to feedback (both
> positive and negative) on it, so please let me know what you think of
> it.
> 
> -Jared Smith
> 
> [1] https://bugzilla.redhat.com/show_bug.cgi?id=495136

I think adding this as a parameter is the wrong approach. There are many
things that have the potential to require adjusting to make non-A4 sizes
look good. Using parameters to set them will lead to either an unusable
system, too many parameters, or unmaintainable XSL, too many paper sizes
adding conditionals to the XSL.

Instead I'd create a new xsl file, e.g. pdf-A3.xsl, which imports pdf.xsl
and over rides the required variables to make US Letter look good.

e.g. default.image.width probably needs to be reduced since A4 is fatter
that US letter and won't look quite right on US letter. Larger paper sizes
can handle larger images without breaking in to the border and so will
also want to over ride this value. two column pages would need to have a
different size again and we are quickly in to spaghetti XSL.

You can place pdf-A3.xsl in  /usr/share/publican/xsl/ and then you need to
make 2 other small changes.

1: modify Makefile.template

ifeq "${1}" "pdf"

becomes: (untested)

ifeq "${1}" ($(findstring, "pdf", ${1}))

i.e. any style sheet with pdf in the name


2: add pdf-A3 to FORMATS in Makefile.common

For testing you can set it on the command line: (untested)

make FORMATS='html pdf-A3' html-en-US pdf-A3-en-US

I believe this approach will lead to a more maintainable system than
trying to shoe horn all possible paper sizes in to one XSL file.

Cheers, Jeff.

-- 
Jeff Fearn <jfearn redhat com>
Software Engineer
Engineering Operations
Red Hat, Inc
Freedom ... courage ... Commitment ... ACCOUNTABILITY


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]