Layout customization

View: New views
4 Messages — Rating Filter:   Alert me  

Layout customization

by Bugzilla from etiennel@scientology.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm currently working on changing the PDF rendering of the Daisy docs. I'm having a
hard time finding documentation on what elements and attributes I have available to
display.

Is there any place where I can find this information?


Also, one thing I'm attempting to do right now which I really have no clue on how to
do is to add an image at the top of the PDF.

Could someone give me pointers or details on how to do that?

Etienne
_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy@...
list information: http://lists.cocoondev.org/mailman/listinfo/daisy

Re: Layout customization

by Bauer Matthias (IFD AIM MC ATM NVTD) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Etienne,

Etienne Lacombe wrote:
> Hi,
>
> I'm currently working on changing the PDF rendering of the Daisy docs. I'm having a
> hard time finding documentation on what elements and attributes I have available to
> display.
>
> Is there any place where I can find this information?

PDF formating is basically done in 2 steps. The document xml is first
converted into XSL-FO, which will be later on rendered by Apache-FOP
into a PDF file.

You can check the w3c.org website for details on the XSL-FO syntax:

        http://www.w3.org/TR/xsl/#fo-section

> Also, one thing I'm attempting to do right now which I really have no clue on how to
> do is to add an image at the top of the PDF.

Well, adding the company logo was the 1st thing I had to do as well. I
wasn't that experienced with XSL-FO at that time. So, it was rather
painful for me as well.

Anyway, here is, what I've done:

Basically, you need to modify the xslt/documentlayout-xslfo.xsl.

(1) Add a page header. So, the logo will be displayed on every page:

(1a) within the <fo:simple-page-master> node add the following lines:

  <xsl:template match="page">
      <fo:root>
        <fo:layout-master-set>
          <fo:simple-page-master
            ...
            <fo:region-body
               region-name="body"
+              margin-top="2.8cm"
               margin-bottom="2.5cm"/>
+           <fo:region-before
+              region-name="top"
+              extent="1.8cm"/>
            <fo:region-after
               region-name="bottom"
               extent="1.5cm"/>
          </fo:simple-page-master>

(1b) a few lines down within <fo:page-sequence
master-reference="simplepage">:

          </fo:static-content>
+         <fo:static-content flow-name="top">
+           <xsl:call-template name="header"/>
+         </fo:static-content>
          <fo:static-content flow-name="bottom">
            <xsl:call-template name="footer"/>
          </fo:static-content>

(2) create a template for the header:

That could be something like that:

+   <xsl:template name="header">
+     <fo:block font-size="11pt"
+       font-family="{$fontSerif}"
+       padding-top="3pt"
+       border-bottom-style="solid"
+       border-bottom-width=".1mm">
+       <fo:block text-align="center">
+         <fo:external-graphic
+            src="url('daisyskin:images/logo.gif')"
+            height="1cm"
+            content-height="1cm"
+            scaling="uniform"/>
+        </fo:block>
+     </fo:block>
+   </xsl:template>

As you can see, an image can be included using <fo:external-graphic>.

HTH

  Matthias Bauer

--
Matthias Bauer

 Infineon Technologies Dresden GmbH
 eNVM Technology Development and Process Integration
 Koenigsbruecker Str. 180
 D-01099 Dresden

 Geschäftsführer: Pantelis Haidas, Helmut Warnecke
 Sitz der Gesellschaft: Dresden
 Registergericht: Dresden, HRB 27169

_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy@...
list information: http://lists.cocoondev.org/mailman/listinfo/daisy

Parent Message unknown Re: Layout customization

by Bugzilla from etiennel@scientology.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Matthias  - that helped me a lot.

Etienne


---------- Original Message -----------
From: daisy-request@...
To: daisy@...
Sent: Fri, 31 Jul 2009 12:00:04 +0200 (CEST)
Subject: daisy Digest, Vol 58, Issue 35

> Date: Thu, 30 Jul 2009 13:50:08 +0200
> From: "Bauer Matthias (IFD AIM MC ATM NVTD)"
> <matthias.bauer.drs@...>
> Subject: Re: [daisy] Layout customization
> To: Daisy@...:open source CMS - general mailinglist
> <daisy@...>
> Message-ID: <4A7188F0.9080202@...>
> Content-Type: text/plain; charset="UTF-8"
>
> Hi Etienne,
>
> Etienne Lacombe wrote:
> > Hi,
> >
> > I'm currently working on changing the PDF rendering of the Daisy docs. I'm having a
> > hard time finding documentation on what elements and attributes I have available to
> > display.
> >
> > Is there any place where I can find this information?
>
> PDF formating is basically done in 2 steps. The document xml is first
> converted into XSL-FO, which will be later on rendered by Apache-FOP
> into a PDF file.
>
> You can check the w3c.org website for details on the XSL-FO syntax:
>
> http://www.w3.org/TR/xsl/#fo-section
>
> > Also, one thing I'm attempting to do right now which I really have no clue on how to
> > do is to add an image at the top of the PDF.
>
> Well, adding the company logo was the 1st thing I had to do as well. I
> wasn't that experienced with XSL-FO at that time. So, it was rather
> painful for me as well.
>
> Anyway, here is, what I've done:
>
> Basically, you need to modify the xslt/documentlayout-xslfo.xsl.
>
> (1) Add a page header. So, the logo will be displayed on every page:
>
> (1a) within the <fo:simple-page-master> node add the following lines:
>
>   <xsl:template match="page">
>       <fo:root>
>         <fo:layout-master-set>
>           <fo:simple-page-master
>    ...
>             <fo:region-body
>                region-name="body"
> +              margin-top="2.8cm"
>                margin-bottom="2.5cm"/>
> +           <fo:region-before
> +              region-name="top"
> +              extent="1.8cm"/>
>             <fo:region-after
>                region-name="bottom"
>                extent="1.5cm"/>
>           </fo:simple-page-master>
>
> (1b) a few lines down within <fo:page-sequence
> master-reference="simplepage">:
>
>           </fo:static-content>
> +         <fo:static-content flow-name="top">
> +           <xsl:call-template name="header"/>
> +         </fo:static-content>
>           <fo:static-content flow-name="bottom">
>             <xsl:call-template name="footer"/>
>           </fo:static-content>
>
> (2) create a template for the header:
>
> That could be something like that:
>
> +   <xsl:template name="header">
> +     <fo:block font-size="11pt"
> +       font-family="{$fontSerif}"
> +       padding-top="3pt"
> +       border-bottom-style="solid"
> +       border-bottom-width=".1mm">
> +       <fo:block text-align="center">
> +         <fo:external-graphic
> +            src="url('daisyskin:images/logo.gif')"
> +            height="1cm"
> +            content-height="1cm"
> +            scaling="uniform"/>
> +        </fo:block>
> +     </fo:block>
> +   </xsl:template>
>
> As you can see, an image can be included using <fo:external-graphic>.
>
> HTH
>
>   Matthias Bauer
>
> --
> Matthias Bauer
>
>  Infineon Technologies Dresden GmbH
>  eNVM Technology Development and Process Integration
>  Koenigsbruecker Str. 180
>  D-01099 Dresden
>
>  Geschäftsführer: Pantelis Haidas, Helmut Warnecke
>  Sitz der Gesellschaft: Dresden
>  Registergericht: Dresden, HRB 27169
>
> ------------------------------
>
_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy@...
list information: http://lists.cocoondev.org/mailman/listinfo/daisy

Re: Layout customization

by Robert Raleigh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

FYI:

I spent quite some time working through the issues related to PDF output to get custom logos, headers, footers, etc. In case it's helpful to anyone else, what I finally settled on that works best for us is to use full-page SVG graphics for the logo, page boundaries, headers, and footers. Think of it as a page border that encompasses all of those elements. On the title page, it includes a large graphic that includes our logo and takes up roughly half the page. On most body pages, it's more like a border. The changeable elements, such as document name, page #, etc., are written over the top of the SVG graphic (the graphic includes a black area in the footer, and I use white text).

To accomplish this, I use the <fo:block-container> element. Here is an example of my modified title page:

      <fo:page-sequence master-reference="frontpage">
        <fo:flow flow-name="body">
            <fo:block-container
                font-family="GroteskLC"
                height="11in"
                width="8.5in"
                absolute-position="absolute"
                top="-1in"
                left="-1in"
                right="-1in"
                bottom="-1in"
                background-image="publicationtype:resources/cover_template_fusion.svg"
                background-repeat="no-repeat">
                <fo:block
                    margin-left="11.5cm"
                    font-size="30pt"
                    font-weight="bold"
                    text-align="left"
                    padding-before="19cm">
                    <xsl:value-of select="/html/metadata/entry[@key='title']"/>
                </fo:block>
                <fo:block
                    margin-left="11.5cm"
                    font-size="24pt"
                    text-align="left"
                    padding-before=".4cm">
                    <xsl:value-of select="/html/metadata/entry[@key='subtitle']"/>
                </fo:block>
                <fo:block
                    margin-left="11.5cm"
                    font-size="16pt"
                    text-align="left"
                    padding-before=".4cm">
                    <xsl:value-of select="/html/properties/entry[@key='publishDate']"/>
                </fo:block>
            </fo:block-container>
        </fo:flow>
      </fo:page-sequence>

I had to make a number of other adjustments to get this to work, such as turning off the headers in the original stylesheets (to be replaced by the upper part of the SVG graphic). If any of you would like to see example PDFs and complete stylesheets, email me off-list. You can get a much more sophisticated looking document using this method. I used it to mirror a design that had been created by our designers originally using InDesign.

Regards,

Robert

Etienne Lacombe wrote:
Thanks Matthias  - that helped me a lot.

Etienne


---------- Original Message -----------
From: daisy-request@...
To: daisy@...
Sent: Fri, 31 Jul 2009 12:00:04 +0200 (CEST)
Subject: daisy Digest, Vol 58, Issue 35

  
Date: Thu, 30 Jul 2009 13:50:08 +0200
From: "Bauer Matthias (IFD AIM MC ATM NVTD)"
	matthias.bauer.drs@...
Subject: Re: [daisy] Layout customization
To: Daisy@... source CMS - general mailinglist
	daisy@...
Message-ID: 4A7188F0.9080202@...
Content-Type: text/plain; charset="UTF-8"

Hi Etienne,

Etienne Lacombe wrote:
    
Hi,

I'm currently working on changing the PDF rendering of the Daisy docs. I'm having a
hard time finding documentation on what elements and attributes I have available to
display.

Is there any place where I can find this information?
      
PDF formating is basically done in 2 steps. The document xml is first
converted into XSL-FO, which will be later on rendered by Apache-FOP
into a PDF file.

You can check the w3c.org website for details on the XSL-FO syntax:

	http://www.w3.org/TR/xsl/#fo-section

    
Also, one thing I'm attempting to do right now which I really have no clue on how to
do is to add an image at the top of the PDF.
      
Well, adding the company logo was the 1st thing I had to do as well. I
wasn't that experienced with XSL-FO at that time. So, it was rather
painful for me as well.

Anyway, here is, what I've done:

Basically, you need to modify the xslt/documentlayout-xslfo.xsl.

(1) Add a page header. So, the logo will be displayed on every page:

(1a) within the <fo:simple-page-master> node add the following lines:

  <xsl:template match="page">
      <fo:root>
        <fo:layout-master-set>
          <fo:simple-page-master
	    ...
            <fo:region-body
               region-name="body"
+              margin-top="2.8cm"
               margin-bottom="2.5cm"/>
+           <fo:region-before
+              region-name="top"
+              extent="1.8cm"/>
            <fo:region-after
               region-name="bottom"
               extent="1.5cm"/>
          </fo:simple-page-master>

(1b) a few lines down within <fo:page-sequence
master-reference="simplepage">:

          </fo:static-content>
+         <fo:static-content flow-name="top">
+           <xsl:call-template name="header"/>
+         </fo:static-content>
          <fo:static-content flow-name="bottom">
            <xsl:call-template name="footer"/>
          </fo:static-content>

(2) create a template for the header:

That could be something like that:

+   <xsl:template name="header">
+     <fo:block font-size="11pt"
+       font-family="{$fontSerif}"
+       padding-top="3pt"
+       border-bottom-style="solid"
+       border-bottom-width=".1mm">
+       <fo:block text-align="center">
+         <fo:external-graphic
+            src="url('daisyskin:images/logo.gif')"
+            height="1cm"
+            content-height="1cm"
+            scaling="uniform"/>
+        </fo:block>
+     </fo:block>
+   </xsl:template>

As you can see, an image can be included using <fo:external-graphic>.

HTH

  Matthias Bauer

-- 
Matthias Bauer

 Infineon Technologies Dresden GmbH
 eNVM Technology Development and Process Integration
 Koenigsbruecker Str. 180
 D-01099 Dresden

 Geschäftsführer: Pantelis Haidas, Helmut Warnecke
 Sitz der Gesellschaft: Dresden
 Registergericht: Dresden, HRB 27169

------------------------------

    
_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy@...
list information: http://lists.cocoondev.org/mailman/listinfo/daisy
  

CONFIDENTIAL

This document and attachments contain information from Fusion-io, Inc. which is confidential and/or legally privileged.
The information is intended only for the use of the individual or entity named on this transmission.
If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking of any
action in reliance on the contents of this emailed information is strictly prohibited, and that the documents should be returned to Fusion-io, Inc. immediately.
In this regard, if you have received this email in error, please notify us by return email immediately.


_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy@...
list information: http://lists.cocoondev.org/mailman/listinfo/daisy