Oops, I've don't read that...

You have to draw it yourself...
I've attached an XSLT file to make it.
You can use it as is, or tune it as you want.

Le 31/03/2011 17:00, Mario Madunic a écrit :
> I've played with various values and when cop-box is set to trim-box the page 
> displayed is the actual page size (3.875w x 6.25h) without the added 
> crop-offset. Can someone please give an example of how to use these 
> extensions to add crop or trim marks.

--
Pascal
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:fo="http://www.w3.org/1999/XSL/Format";>

<xsl:variable name="pageWidth" select="210"/>
<xsl:variable name="pageHeight" select="297"/>

<xsl:template name="cropAndCenterMark">
  <xsl:variable name="Wmm" select="concat($pageWidth,'mm')"/>
  <xsl:variable name="Hmm" select="concat($pageHeight,'mm')"/>
  <!-- bottom-right -->
  <xsl:call-template name="cropMark">
    <xsl:with-param name="x" select="$Wmm"/>
    <xsl:with-param name="y" select="$Hmm"/>
    <xsl:with-param name="rotation" select="0"/>
  </xsl:call-template>
  <!-- top-right -->
  <xsl:call-template name="cropMark">
    <xsl:with-param name="x" select="$Wmm"/>
    <xsl:with-param name="y" select="'0mm'"/>
    <xsl:with-param name="rotation" select="90"/>
  </xsl:call-template>
  <!-- top-left -->
  <xsl:call-template name="cropMark">
    <xsl:with-param name="x" select="'0mm'"/>
    <xsl:with-param name="y" select="'0mm'"/>
    <xsl:with-param name="rotation" select="180"/>
  </xsl:call-template>
  <!-- bottom-left -->
  <xsl:call-template name="cropMark">
    <xsl:with-param name="x" select="'0mm'"/>
    <xsl:with-param name="y" select="$Hmm"/>
    <xsl:with-param name="rotation" select="270"/>
  </xsl:call-template>
  <!-- bottom -->
  <xsl:call-template name="centerMark">
    <xsl:with-param name="x" select="'0mm'"/>
    <xsl:with-param name="y" select="$Hmm"/>
    <xsl:with-param name="w" select="$Wmm"/>
    <xsl:with-param name="rotation" select="0"/>
  </xsl:call-template>
  <!-- right -->
  <xsl:call-template name="centerMark">
    <xsl:with-param name="x" select="$Wmm"/>
    <xsl:with-param name="y" select="$Hmm"/>
    <xsl:with-param name="w" select="$Hmm"/>
    <xsl:with-param name="rotation" select="90"/>
  </xsl:call-template>
  <!-- top -->
  <xsl:call-template name="centerMark">
    <xsl:with-param name="x" select="$Wmm"/>
    <xsl:with-param name="y" select="'0mm'"/>
    <xsl:with-param name="w" select="$Wmm"/>
    <xsl:with-param name="rotation" select="180"/>
  </xsl:call-template>
  <!-- left -->
  <xsl:call-template name="centerMark">
    <xsl:with-param name="x" select="'0mm'"/>
    <xsl:with-param name="y" select="'0mm'"/>
    <xsl:with-param name="w" select="$Hmm"/>
    <xsl:with-param name="rotation" select="270"/>
  </xsl:call-template>
</xsl:template>

<xsl:template name="cropMark">
  <xsl:param name="x" select="'0mm'"/>
  <xsl:param name="y" select="'0mm'"/>
  <xsl:param name="rotation" select="0"/>
  <xsl:variable name="offsetX">
    <xsl:if test="$rotation=180 or $rotation=270"> - 30pt</xsl:if>
  </xsl:variable>
  <xsl:variable name="offsetY">
    <xsl:if test="$rotation=90 or $rotation=180"> - 30pt</xsl:if>
  </xsl:variable>
  <fo:block-container absolute-position="absolute"
      left="{$x}{$offsetX}" top="{$y}{$offsetY}"
      width="30pt" height="30pt" reference-orientation="{$rotation}">
    <fo:block font-size="0pt">
      <fo:instream-foreign-object content-width="30pt" content-height="30pt">
        <svg xmlns="http://www.w3.org/2000/svg";
          width="30" height="30" viewBox="0 0 30 30">
          <g style="stroke:black;stroke-width:0.25">
            <line x1="6" y1="0" x2="30" y2="0"/>
            <line x1="0" y1="6" x2="0" y2="30"/>
          </g>
        </svg>
      </fo:instream-foreign-object>
    </fo:block>
  </fo:block-container>
</xsl:template>

<xsl:template name="centerMark">
  <xsl:param name="x" select="'0mm'"/>
  <xsl:param name="y" select="'0mm'"/>
  <xsl:param name="w" select="'0mm'"/>
  <xsl:param name="rotation" select="0"/>
  <xsl:variable name="offsetX">
    <xsl:choose>
      <xsl:when test="$rotation=180">
        <xsl:text> - </xsl:text>
        <xsl:value-of select="$w"/>
      </xsl:when>
      <xsl:when test="$rotation=270"> - 30pt</xsl:when>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="offsetY">
    <xsl:choose>
      <xsl:when test="$rotation=90">
        <xsl:text> - </xsl:text>
        <xsl:value-of select="$w"/>
      </xsl:when>
      <xsl:when test="$rotation=180"> - 30pt</xsl:when>
    </xsl:choose>
  </xsl:variable>
  <fo:block-container absolute-position="absolute"
      left="{$x}{$offsetX}" top="{$y}{$offsetY}"
      width="{$w}" height="30pt" reference-orientation="{$rotation}"
      text-align="center" display-align="after">
    <fo:block font-size="0pt">
      <fo:instream-foreign-object content-width="48pt" content-height="24pt">
        <svg xmlns="http://www.w3.org/2000/svg";
          width="48" height="24" viewBox="0 0 48 24">
          <g style="fill: none; stroke:black; stroke-width:0.25;">
            <line x1="0" y1="12" x2="48" y2="12"/>
            <line x1="24" y1="0" x2="24" y2="24"/>
            <circle cx="24" cy="12" r="6"/>
          </g>
        </svg>
      </fo:instream-foreign-object>
    </fo:block>
  </fo:block-container>
</xsl:template>
</xsl:transform>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to