Commit ac1948bf authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

Merge branch 'ag/tei_pdf' into 'dev'

amélioration du pdf pour la tei

See merge request pdn-certic/MaX!77
parents 267615f9 efbc7a3f
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -13,12 +13,13 @@ declare
%rest:path("/{$project}/{$routeDoc=.*\.xml}/{$id}.pdf")
function max.plugins.tei2pdf:fragmentToPDF($project, $routeDoc, $id){
    let $dbPath := max.config:getProjectDBPath($project)
    let $teiHeader := doc($dbPath || '/' || $routeDoc)//*:teiHeader
    let $content:=
        <TEI xmlns="http://www.tei-c.org/ns/1.0">
            <teiHeader></teiHeader>
            <teiHeader>{$teiHeader}</teiHeader>
            <text>{max.api:getXMLByID($dbPath, $id)}</text>
        </TEI>

    (: return $content :)
    let $pdf := max.util:xml2pdf($content, max.util:getProjectFoXsl($project),$project,$id)
    return
        (<rest:response>
+13 −0
Original line number Diff line number Diff line
.tei2pdf span.texte {
    font-size:10px;
    color:#155a84;
    padding-left:1px;
}

.tei2pdf a {
    text-decoration: none;
}

.tei2pdf a:hover {
    color:initial;
}
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ declare variable $id external;

<div class="tei2pdf">
    <a role="button" title="Export pdf" target="_blank" href="./{$id}.pdf">
        &#8682;
        &#8682;<span class="texte">PDF</span>
    </a>
</div>
+11 −13
Original line number Diff line number Diff line
@@ -21,11 +21,9 @@
  <xsl:template match="ead:frontmatter"/>
  <xsl:template match="ead:*[@audience='internal']"/>

  <xsl:variable name="pretty-name">
  <!-- <xsl:variable name="pretty-name">
    <xsl:value-of select="$prettyName"/>
  </xsl:variable>


  </xsl:variable> -->


  <xsl:template match="ead:ead">
@@ -35,7 +33,7 @@
        <!-- Les gabarits de page. Au moins 1 simple-page-master obligatoire-->
        <fo:simple-page-master master-name="couverture" margin-top="40mm" margin-bottom="5mm" margin-left="20mm" margin-right="40mm">
          <fo:region-body margin-bottom="20mm" margin-top="20mm"/>
          <fo:region-after extent="1cm" region-name="pied-couverture"/>
          <fo:region-after extent="10mm" region-name="pied-couverture"/>
        </fo:simple-page-master>

        <fo:simple-page-master master-name="premiere" margin-top="10mm" margin-bottom="10mm" margin-left="25mm" margin-right="25mm">
@@ -45,14 +43,14 @@

        <fo:simple-page-master master-name="impaire" margin-top="10mm" margin-bottom="5mm" margin-left="25mm" margin-right="25mm">
          <fo:region-body margin-bottom="20mm" margin-top="20mm"/>
          <fo:region-before extent="1cm" region-name="entete-impaire"/>
          <fo:region-after extent="1cm" region-name="pied-impaire"/>
          <fo:region-before extent="10mm" region-name="entete-impaire"/>
          <fo:region-after extent="10mm" region-name="pied-impaire"/>
        </fo:simple-page-master>

        <fo:simple-page-master master-name="paire" margin-top="10mm" margin-bottom="5mm" margin-left="25mm" margin-right="25mm">
          <fo:region-body margin-bottom="20mm" margin-top="20mm"/>
          <fo:region-before extent="1cm" region-name="entete-paire"/>
          <fo:region-after extent="1cm" region-name="pied-paire"/>
          <fo:region-before extent="10mm" region-name="entete-paire"/>
          <fo:region-after extent="10mm" region-name="pied-paire"/>
        </fo:simple-page-master>

        <!-- Le modèle de séquence de pages avec enchaînement impaire/paire -->
@@ -76,7 +74,7 @@
        </fo:static-content>
        <fo:flow flow-name="xsl-region-body">
          <fo:block text-align="center" font-size="14pt" font-style="italic" space-after="16pt">
            <xsl:value-of select="$pretty-name"/>
            <xsl:value-of select="$prettyName"/>
          </fo:block>
          <fo:block text-align="center" font-size="14pt" font-weight="bold" space-after="26pt">
            <xsl:value-of select="ead:eadheader/ead:filedesc/ead:titlestmt/ead:titleproper"/>
@@ -104,7 +102,7 @@
        </fo:static-content>
        <fo:static-content flow-name="entete-impaire">
          <xsl:call-template name="output-header">
            <xsl:with-param name="pretty-name" select="$pretty-name"/>
            <xsl:with-param name="prettyName" select="$prettyName"/>
          </xsl:call-template>
        </fo:static-content>
        <fo:static-content flow-name="pied-impaire">
@@ -113,7 +111,7 @@
        </fo:static-content>
        <fo:static-content flow-name="entete-paire">
          <xsl:call-template name="output-header">
            <xsl:with-param name="pretty-name" select="$pretty-name"/>
            <xsl:with-param name="prettyName" select="$prettyName"/>
          </xsl:call-template>
        </fo:static-content>
        <fo:static-content flow-name="pied-paire">
@@ -132,7 +130,7 @@
            <xsl:apply-templates />
          </fo:block>
          <!-- On insère ici un marqueur afin de connaître le nombre total de pages -->
          <block id="last-page"/>
          <fo:block id="last-page"/>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
+2 −7
Original line number Diff line number Diff line
@@ -6,24 +6,19 @@
    xmlns:ead="urn:isbn:1-931666-22-9"
    xmlns:i18n="http://apache.org/cocoon/i18n/2.1" exclude-result-prefixes="xsl xhtml">



    <!-- Le template de l'en-tête -->
    <xsl:template name="output-header">
        <xsl:param name="pretty-name"/>
        <xsl:param name="prettyName"/>
        <xsl:param name="bloc-biblio"/>
        <!-- Un block-container permet de fixer une hauteur, et donc d'ajuster l'image de fond -->
        <block-container xsl:use-attribute-sets="containerPrettyName">
            <!-- Le contenu -->
            <block xsl:use-attribute-sets="prettyName">
                <xsl:value-of select="$pretty-name"/>
                <xsl:value-of select="$prettyName"/>
            </block>
        </block-container>
        <block xsl:use-attribute-sets="titlePage">
            <xsl:apply-templates select="../*:frontmatter/*:titlepage"/>
        </block>
    </xsl:template>

    

</xsl:stylesheet>
 No newline at end of file
Loading