docbook-apps

  • 1.  Stamp in outer margin

    Posted 01-23-2009 23:26
    Hello Everyone,

    I'd like to add stamp (picture) to the outer margin of PDF file, but I've
    found it is probably impossible as there are only specified
    header/body/footer areas on all default templates. It is intended as static
    content. I've tried to modify header template (to add the block container
    with absolute position to ensure its position in proper place), but while
    left attribute is preserved, top attribute is ignored in XEP. I don't know
    exactly if such block out of defined static area is legal or it is not
    supported in XEP. If there are any more straightforward solutions, please
    let me know.

    Jan




  • 2.  RE: [docbook-apps] Stamp in outer margin

    Posted 01-24-2009 13:43
    I do something like that but with text rather than an image. I put a
    fo:leader rotated 90 degrees in the left margin and repeat its contents.
    The contents of the leader depend on a parameter I pass in. You could
    adapt it to use an image instead by replacing the fo:leader with what
    you want and ajusting the position of the fo:block-container.

    I ended up liking the text inside a leader on the left side of the page
    approach over the draft.png watermark for several reasons. 1) The draft
    image didn't appear when the pdf is printed (depends on printer and how
    dark you made the image), and 2) Even if you make the draft.png pretty
    light (so much so that it doesn't print on most printers) having it
    behind the content of the page makes the page hard to read. The repeated
    text in the leader in the left margin can be as dark as you want without
    making the text on the page unreadable. I suppose someone could alter
    the pdf to remove it, but it would require some effort.

    Xsl pasted below. I also use XEP.

    David


    <xsl:param name="motive.footer.text">
    <xsl:choose>
    <xsl:when test="$security = 'external' and $nda.footer =
    'true' and $include.alcatel.cobranding != 0">Motive and Alcatel-Lucent
    Confidential</xsl:when>
    <xsl:when test="$security = 'external' and $nda.footer =
    'true'"><xsl:value-of select="$nda.footer.text"/></xsl:when>
    <xsl:when test="$security = 'external'"/>
    <xsl:when test="$security = 'writeronly'">Writer Only Copy -
    Internal Only</xsl:when>
    <xsl:when test="$security = 'reviewer'">Reviewer Copy -
    Internal Only</xsl:when>
    <xsl:when test="$protected = 'yes'">Internal Only
    (Protected)</xsl:when>
    <xsl:when test="$security = 'bjinternal'">Internal
    Only</xsl:when>
    <xsl:otherwise/>
    </xsl:choose>
    </xsl:param>


    <xsl:template name="document.status.bar">
    <fo:block-container reference-orientation="90"
    absolute-position="fixed" height="3in" width="11in" z-index="1">
    <fo:block padding-before=".45in" font-size="1.5em"
    color="gray" font-weight="bold">
    <fo:leader leader-pattern="use-content"
    leader-length="15in" letter-spacing=".1em"><xsl:text>
    </xsl:text><xsl:value-of select="$motive.footer.text"/><xsl:text>
    </xsl:text></fo:leader>
    </fo:block>
    </fo:block-container>
    </xsl:template>


    <xsl:template match="*" mode="running.head.mode">
    <xsl:param name="master-reference" select="'unknown'"/>
    <xsl:param name="gentext-key" select="local-name(.)"/>


    <xsl:variable name="pageclass">
    <xsl:choose>
    <xsl:when test="contains($master-reference, '-draft')">
    <xsl:value-of select="substring-before($master-reference,
    '-draft')"/>
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="$master-reference"/>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:variable>

    <fo:static-content flow-name="xsl-region-before-first">
    <xsl:call-template
    name="document.status.bar"/>

    <fo:block xsl:use-attribute-sets="header.content.properties">
    <xsl:call-template name="header.table">
    <xsl:with-param name="pageclass" select="$pageclass"/>
    <xsl:with-param name="sequence" select="'first'"/>
    <xsl:with-param name="gentext-key" select="$gentext-key"/>
    </xsl:call-template>
    </fo:block>
    </fo:static-content>

    <fo:static-content flow-name="xsl-region-before-odd">
    <xsl:call-template
    name="document.status.bar"/>

    <fo:block xsl:use-attribute-sets="header.content.properties">
    <xsl:call-template name="header.table">
    <xsl:with-param name="pageclass" select="$pageclass"/>
    <xsl:with-param name="sequence" select="'odd'"/>
    <xsl:with-param name="gentext-key" select="$gentext-key"/>
    </xsl:call-template>
    </fo:block>
    </fo:static-content>

    <fo:static-content flow-name="xsl-region-before-even">
    <xsl:call-template
    name="document.status.bar"/>

    <fo:block xsl:use-attribute-sets="header.content.properties">
    <xsl:call-template name="header.table">
    <xsl:with-param name="pageclass" select="$pageclass"/>
    <xsl:with-param name="sequence" select="'even'"/>
    <xsl:with-param name="gentext-key" select="$gentext-key"/>
    </xsl:call-template>
    </fo:block>
    </fo:static-content>

    <fo:static-content flow-name="xsl-region-before-blank">
    <xsl:call-template
    name="document.status.bar"/>

    <fo:block xsl:use-attribute-sets="header.content.properties">
    <xsl:call-template name="header.table">
    <xsl:with-param name="pageclass" select="$pageclass"/>
    <xsl:with-param name="sequence" select="'blank'"/>
    <xsl:with-param name="gentext-key" select="$gentext-key"/>
    </xsl:call-template>
    </fo:block>
    </fo:static-content>

    <xsl:call-template name="footnote-separator"/>

    <xsl:if test="$fop.extensions = 0 and $fop1.extensions = 0">
    <xsl:call-template name="blank.page.content"/>
    </xsl:if>
    </xsl:template>

    >