[SPAM] Re: [xep-support] New Installment of CoolTools - The Document Magnifier

Kevin Brown kevin at renderx.com
Tue Aug 10 09:45:52 PDT 2010


Ron:

1) Can this be applied to part of a document?

Certainly. Taking into account that the special XEPOUT tags like
<xep:translate> and <xep:transform> simply operate on all content that
follows them inside the page -- which means they are also additive. Try this
sample --- save it to "sample.xep" and run it with xep.bat -xep "sample.xep"
-pdf "fancy.pdf". 

In this sample you can see a series of <xep:transform> elements are placed
to incrementally shrink and rotate text.

<?xml version="1.0" encoding="UTF-8"?>

<xep:document xmlns:xep="http://www.renderx.com/XEP/xep" producer="XEP 4.17
build 20091204"
    creator="RenderX VisualXSL" author="Unknown" title="Untitled">
    <xep:page width="612000" height="792000" page-number="1" page-id="1">
        <xep:word-spacing value="0"/>
        <xep:letter-spacing value="0"/>
        <xep:font-stretch value="1.0"/>
        
        <!-- Put the pinwheel wherever on the page -->
        <xep:translate x="250000" y="500000"/>

        <xep:gray-color gray="0.0"/>
        <xep:font family="Helvetica" weight="400" style="normal"
variant="normal" size="22000"/>
        <xep:text value="My life is slowly draining away, help me" x="20000"
y="0" width="8985"/>
        
        <xep:gray-color gray="0.083"/>
        <xep:font family="Helvetica" weight="375" style="normal"
variant="normal" size="20000"/>
	  <!-- Rotate and shrink the text -->
        <xep:transform a="0.866025" b="-0.5" c="0.5" d="0.866025" e="0"
f="0"/>
        <xep:text value="My life is slowly draining away, help me" x="18000"
y="0" width="8985"/>
        
        <xep:gray-color gray="0.0909"/>
        <xep:font family="Helvetica" weight="350" style="normal"
variant="normal" size="18000"/>
        <xep:transform a="0.866025" b="-0.5" c="0.5" d="0.866025" e="0"
f="0"/>
        <xep:text value="My life is slowly draining away, help me" x="16000"
y="0" width="8985"/>
        
        <xep:gray-color gray="0.1"/>
        <xep:font family="Helvetica" weight="325" style="normal"
variant="normal" size="16000"/>
        <xep:transform a="0.866025" b="-0.5" c="0.5" d="0.866025" e="0"
f="0"/>
        <xep:text value="My life is slowly draining away, help me" x="14000"
y="0" width="8985"/>
        
        <xep:gray-color gray="0.1111"/>
        <xep:font family="Helvetica" weight="300" style="normal"
variant="normal" size="14000"/>
        <xep:transform a="0.866025" b="-0.5" c="0.5" d="0.866025" e="0"
f="0"/>
        <xep:text value="My life is slowly draining away, help me" x="12000"
y="0" width="8985"/>
        
        <xep:gray-color gray="0.125"/>
        <xep:font family="Helvetica" weight="275" style="normal"
variant="normal" size="12000"/>
        <xep:transform a="0.866025" b="-0.5" c="0.5" d="0.866025" e="0"
f="0"/>
        <xep:text value="My life is slowly draining away, help me" x="10000"
y="0" width="8985"/>
        
        <xep:gray-color gray="0.1428"/>
        <xep:font family="Helvetica" weight="250" style="normal"
variant="normal" size="10000"/>
        <xep:transform a="0.866025" b="-0.5" c="0.5" d="0.866025" e="0"
f="0"/>
        <xep:text value="My life is slowly draining away, help me" x="8000"
y="0" width="8985"/>
        
        <xep:gray-color gray="0.1666"/>
        <xep:font family="Helvetica" weight="225" style="normal"
variant="normal" size="8000"/>
        <xep:transform a="0.866025" b="-0.5" c="0.5" d="0.866025" e="0"
f="0"/>
        <xep:text value="My life is slowly draining away, help me" x="6000"
y="0" width="8985"/>
        
        <xep:gray-color gray="0.2"/>
        <xep:font family="Helvetica" weight="200" style="normal"
variant="normal" size="6000"/>
        <xep:transform a="0.866025" b="-0.5" c="0.5" d="0.866025" e="0"
f="0"/>
        <xep:text value="My life is slowly draining away, help me" x="4000"
y="0" width="8985"/>

        <xep:gray-color gray="0.25"/>
        <xep:font family="Helvetica" weight="175" style="normal"
variant="normal" size="4000"/>
        <xep:transform a="0.866025" b="-0.5" c="0.5" d="0.866025" e="0"
f="0"/>
        <xep:text value="My life is slowly draining away, help me" x="2000"
y="0" width="8985"/>
    
        <xep:gray-color gray="0.333333"/>
        <xep:font family="Helvetica" weight="150" style="normal"
variant="normal" size="2000"/>
        <xep:transform a="0.866025" b="-0.5" c="0.5" d="0.866025" e="0"
f="0"/>
        <xep:text value="My life is slowly draining away, help me" x="1000"
y="0" width="8985"/>
    
        <xep:gray-color gray="0.5"/>
        <xep:font family="Helvetica" weight="125" style="normal"
variant="normal" size="1000"/>
        <xep:transform a="0.866025" b="-0.5" c="0.5" d="0.866025" e="0"
f="0"/>
        <xep:text value="My life is slowly draining away, help me" x="0"
y="0" width="8985"/>
        
    </xep:page>
</xep:document>

2) It looks as though I could insert an affine matrix for 90 degree rotation
before the table, and apply another after the table to rotate in the
opposite sense.

I am not sure what you are trying to accomplish. Remember that you are
operating on post-composed content here. You would need to build the content
first, this is only allowing you to change the appearance of that content
after composed. We have done some things like you mention using PMSI from
Ken Holman or even some custom XSLs for "table cutting" -- chopping "a"
table (one that exceeds pages in both dimensions) into a smaller table
(knowing the number of columns that fit on a page), formatting that table to
output and then reordering the pages in the XEPOUT to go "across" instead of
"down". 

Remember all -- we are always happy to see a challenge and solve the issue
so send something along for us to understand what you are trying to
accomplish and we'll see what we can dream up. If you run the example above,
you can see that there are things you can do with XEP that you never knew
you could!

Kevin


-----Original Message-----
From: owner-xep-support at renderx.com [mailto:owner-xep-support at renderx.com]
On Behalf Of Ron Catterall
Sent: Saturday, August 07, 2010 8:42 AM
To: xep-support at renderx.com
Subject: [SPAM] Re: [xep-support] New Installment of CoolTools - The
Document Magnifier

Hi
Can this be applied to part of a document?  Specifically, a landscape wide
table spread over several pages in the middle of a portrait orientation
document.  It looks as though I could insert an affine matrix for 90 degree
rotation before the table, and apply another after the table to rotate in
the opposite sense.
I'm thinking of Docbook, where landscape can only be applied to a single
page.  I know it can be done on the Docbook FO output, but this looks like a
neater way to do it.
Or have I got it all wrong?
Ron

On 8/7/10 9:03 AM, Andy Black wrote:
> Thanks, Kevin.  This worked great for me. Much appreciated.
>
> --Andy
>
> On 8/5/2010 4:53 PM, Kevin Brown wrote:
>> Inspired by a recent post by Andy Black, I thought I would put 
>> together a quick XSL for magnifying documents.
>>
>> As with most CoolTools, this one relies on the XEP Intermediate 
>> Format -- we call it XEPOUT. This format is documented here:
>>
>> http://www.renderx.com/reference.html#IntermediateFormatSpecification
>>
>> Remember -- there are many ways to get XEPOUT format. If you are 
>> running from the command line, you can use xep.bat. Instead of 
>> specifying -pdf or -ps for the output format, you just use -xep. So 
>> you might have something
>> like:
>>
>> 	xep.bat -xml myxml.xml -xsl myxsl.xsl -xep resultXEPOUT.xep
>>
>> You can also get XEPOUT programmatically by setting the mimetype to 
>> "application/xep". To format a modified XEPOUT, one just passes it 
>> back through RenderX. For xep.bat, one would use:
>>
>> 	xep.bat -xep resultXEPOUT.xep -pdf mypdf.pdf
>>
>> The document is not recomposed, only the final output is generated. 
>> As we have shown in previous posts, you can do something like 
>> concatenate 1000s of XEPOUT files together and create *huge* outputs 
>> as this final process from XEPOUT to output (like PDF or PostScript) 
>> is very fast and takes very little memory.
>>
>> What is not documented at the above link is that there is also an 
>> XEPOUT element called "xep:transform". It is not documented because 
>> while it is built into the XEP Engine, there are no constructs in FO 
>> that currently cause this element to be created. However, that 
>> doesn't stop us from telling you about it nor using it in various
projects we have created.
>>
>> The "transform" element allows you to apply an affine matrix to all 
>> content that follows this element. Since Andy is looking for scaling, 
>> we could insert something like this in the XEPOUT document to scale 
>> the elements that
>> follow:
>>
>> <xep:transform a="2" b="0" c="0" d="2" e="0" f="0"/>
>>
>> Now, for the engineers out there, you would recall this is 
>> essentially (my math is rusty but I think I have this one right!):
>>
>>   | 2 0 0 |
>>   | 0 2 0 |
>>   | 0 0 1 |
>>
>> Where the attributes are as following for an affine matrix:
>>
>>   | a b 0 |
>>   | c d 0 |
>>   | e f 1 |
>>
>> If the above<xep:transform>  element inserted into the XEPOUT, it 
>> would scale all content following it. The scale would be "2" (double 
>> the size) because "a" and "d" (scale-x and scale-y respectively) are 
>> 2. You should note that all elements work ... if you would like to 
>> see cool examples with text that is rotated at arbitrary degrees and 
>> progressively scaled, just say so. This element allows you to scale,
translate and rotate.
>>
>> Back to Andy's needs .... Now, we also need to change the page 
>> dimensions to accommodate the size. We could write an easy 
>> identity-translate to operate on XEPOUT and scale pages. By the way, 
>> choosing something like scale-x as "5" and scale-y as "1" will turn 
>> you pages into silly putty, if that is what you want, my kids thought
that way funny when I did it!
>>
>> *****************************************
>>
>> <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet 
>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>>      xmlns:xep="http://www.renderx.com/XEP/xep"  version="1.0">
>>      <xsl:param name="scale-x">3</xsl:param>
>>      <xsl:param name="scale-y">3</xsl:param>
>>      <xsl:template match="xep:document">
>>          <xsl:copy>
>>              <xsl:apply-templates select="@*" mode="identity-copy"/>
>>              <xsl:apply-templates/>
>>          </xsl:copy>
>>      </xsl:template>
>>
>>      <xsl:template match="xep:page">
>>          <xep:page>
>>              <!-- Scale the page width and height -->
>>              <xsl:attribute name="width">
>>                  <xsl:value-of select="@width * $scale-x"/>
>>              </xsl:attribute>
>>              <xsl:attribute name="height">
>>                  <xsl:value-of select="@height * $scale-y"/>
>>              </xsl:attribute>
>>              <xsl:attribute name="page-number">
>>                  <xsl:value-of select="@page-number"/>
>>              </xsl:attribute>
>>              <xsl:attribute name="page-id">
>>                  <xsl:value-of select="@page-id"/>
>>              </xsl:attribute>
>>              <!-- Insert Transform -->
>>              <xep:transform a="{$scale-x}" b="0" c="0" d="{$scale-y}"
e="0"
>> f="0"/>
>>              <!-- Output Content -->
>>              <xsl:apply-templates select="*" mode="identity-copy"/>
>>          </xep:page>
>>      </xsl:template>
>>
>>      <!-- identity copy rules -->
>>      <xsl:template match="node() | @*" mode="identity-copy"
>> name="identity-copy">
>>          <xsl:copy>
>>              <xsl:apply-templates select="@*" mode="identity-copy"/>
>>              <xsl:apply-templates select="node()" mode="identity-copy"/>
>>          </xsl:copy>
>>      </xsl:template>
>>
>> </xsl:stylesheet>
>>
>> *************************************************
>>
>> Give it a try! If you would like a set of samples, I would be happy 
>> to share but I promised a quick post to help Andy out and here it is.
>>
>> Kevin Brown
>> RenderX Inc
>> kevin at renderx.com
>> 650-327-1000
>>
>>
>> -------------------
>> (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
>> in the body of the message tomajordomo at renderx.com  from the address 
>> you are subscribed from.
>> (*) By using the Service, you expressly agree to these Terms of 
>> Servicehttp://www.renderx.com/terms-of-service.html
>>
>>
> !DSPAM:28,4c5d6797409585460055303! ------------------- (*) To 
> unsubscribe, send a message with words 'unsubscribe xep-support' in 
> the body of the message to majordomo at renderx.com from the address you 
> are subscribed from. (*) By using the Service, you expressly agree to 
> these Terms of Service http://www.renderx.com/terms-of-service.html

--
Ron Catterall Ph.D. D.Sc.
ron at catterall.net
http://catterall.net


-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo at renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/terms-of-service.html



More information about the Xep-support mailing list