xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pascal Sancho <pascal.san...@takoma.fr>
Subject Re: crop marks in apache fop...
Date Mon, 06 Feb 2012 16:38:25 GMT
Hi Philip,

Unless there is copyright limitation, please don't ask privately a
question that can help everyone on Fop User list, *all* FOP usage
related questions are relevant there.

That said, what you cited is a short snippet that should be used in
XSLT, within a static region:
<fo:static-content flow-name="xsl-region-start">
  <!-- put normal static content here -->
  <xsl:call-template name="cropAndCenterMark"/>
</fo:static-content>

You can use the file attached in cited thread directly, by using a
xsl:include statement in your favorite XSLT:
the file RO_bogst_N.xsl, reading your command line args.


Le 06/02/2012 15:53, Philip Diderichsen a écrit :
> Hi Pascal,
> I read your comments at gmane about crop marks in fop (here:
> http://comments.gmane.org/gmane.text.xml.fop.user/32541).
>  
> Well - I'm a newbie at this! You posted an xsl file, and I kind of
> understand what it does - ALMOST. (Generates svgs of crop marks, puts
> them in the right place..) What I don't understand is how/when do you
> actually employ that file in the generation of a pdf file?
>  
> So basically, my question is this... I run fop with the standard
> command, like so:
> fop -c C:\Programs\fop-1.0\conf\fop-conf.xml -xml RO_bogst_N.xml -xsl
> RO_bogst_N.xsl -pdf N.pdf
>  
> When in the process is your xsl file employed? Should it be embedded in
> my xsl file, or what?
>  
> I hope my question is a dumb one so that it will be easy to answer... ;-)
>  
> Appreciate it,
> Philip
>  
> I pasted your xsl here for convenience:
>  
>  
> <?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>

-- 
Pascal

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message