OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: Embed a PDF document into DocBook book?


Scott Hudson <scott.hudson <at> flatironssolutions.com> writes:

> 
> John Brown and Jirka Kosek both had good suggestions to split the case 
> study into individual pages using pdftk and then use mediaobject.
> 
> This approach seems to work pretty well, although the generated index 
> entries don't seem to point to the same page where the image is rendered 
> (pretty close, though).
>

Never used indexterm, so I have no idea.
 
<! -- Docbook code snipped -->

> 
> The biggest problem I'm having now is that the image doesn't appear to 
> scale the entire width of the page. I'm using XEP, but FOP 0.95 does the 
> same (or worse).
> 
> What am I missing? I've tried width="100%" but that also errors. I've 
> also tried setting the default.image.width param, but that doesn't seem 
> to work either.
> 
> Any ideas?
> 
> Thanks and best regards,
> 
> --Scott

DocBook is making the image fit within the margins. The answer is
to define custom page masters with left and right margins = 0.
Maybe you will also want to suppress the normal DocBook headers
and footers with titles and page numbers.

The following code allows you to write
<appendix role='external-doc'>
  <mediaobject>
    ...
  </mediaobject>
  <mediaobject>
    ...
  </mediaobject>
  <!-- etc. -->
</appendix>

If your external page is the same size as your DocBook page, it will
take up the entire page.

<xsl:template name="user.pagemasters">
  <fo:simple-page-master master-name="back-odd-body-only"
                           page-width="{$page.width}"
                           page-height="{$page.height}"
                           margin-top="0"
                           margin-bottom="0"
                           margin-left="0"
                           margin-right="0">
      <xsl:if test="$axf.extensions != 0">
        <xsl:call-template name="axf-page-master-properties">
          <xsl:with-param name="page.master">back-odd-body-only</xsl:with-param>
        </xsl:call-template>
      </xsl:if>
      <fo:region-body margin-bottom="0"
                      margin-top="0"
                      column-gap="{$column.gap.back}"
                      column-count="{$column.count.back}">
      </fo:region-body>

    </fo:simple-page-master>

    <fo:simple-page-master master-name="back-even-body-only"
                           page-width="{$page.width}"
                           page-height="{$page.height}"
                           margin-top="0"
                           margin-bottom="0"
                           margin-left="0"
                           margin-right="0">
      <xsl:if test="$axf.extensions != 0">
        <xsl:call-template name="axf-page-master-properties">
          <xsl:with-param name="page.master">back-even-body-only</xsl:with-param>
        </xsl:call-template>
      </xsl:if>
      <fo:region-body margin-bottom="0"
                      margin-top="0"
                      column-gap="{$column.gap.back}"
                      column-count="{$column.count.back}">
      </fo:region-body>
    </fo:simple-page-master>

    <fo:page-sequence-master master-name="back-body-only">
      <fo:repeatable-page-master-alternatives>
        <fo:conditional-page-master-reference master-reference="blank"
                                              blank-or-not-blank="blank"/>
        <fo:conditional-page-master-reference master-reference="back-first"
                                              page-position="first"/>
        <fo:conditional-page-master-reference master-reference="back-odd-body-only"
                                              odd-or-even="odd"/>
        <fo:conditional-page-master-reference odd-or-even="even">
          <xsl:attribute name="master-reference">
            <xsl:choose>
              <xsl:when test="$double.sided !=0">back-even-body-only</xsl:when>
              <xsl:otherwise>back-odd-body-only</xsl:otherwise>
            </xsl:choose>
          </xsl:attribute>
        </fo:conditional-page-master-reference>
      </fo:repeatable-page-master-alternatives>
    </fo:page-sequence-master>
 
  </xsl:template>

<xsl:template name="select.user.pagemaster">
  <xsl:param name="element"/>
  <xsl:param name="pageclass"/>
  <xsl:param name="default-pagemaster"/>

  <!-- Return my customized title page master name if for titlepage,
       otherwise return the default -->

  <xsl:choose>
    <xsl:when test="@role = 'external-doc'">
      <xsl:value-of select="'back-body-only'" />
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$default-pagemaster"/>
    </xsl:otherwise>
  </xsl:choose>
  </xsl:template>

  <xsl:template match="d:appendix[@role='external-doc']/d:mediaobject">
    <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"; font-size="0"
line-height="0" break-before="page" 
              break-after="page"   start-indent="0" end-indent="0">
      <xsl:apply-imports/>
    </fo:block>
  </xsl:template>

I am not sure if the back-body-even-only and back-body-odd-only
page masteres are strictly necessary.

See the following thread:
http://thread.gmane.org/gmane.text.docbook.apps/19707





[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]