<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
<document filename="test_016_pagecatcher.pdf"> 


<template pageSize="(595, 842)" leftMargin="72" showBoundary="0">
	<pageTemplate id="main">
	<pageGraphics>
        <fill color="purple"/>
		<setFont name="Helvetica-BoldOblique" size="18"/>
		<drawRightString x="523" y="820">RML2PDF Test Suite - Test #16</drawRightString>
        <rect x="36" y ="800" width="524" height="10" fill="1"/>
        <rect x="36" y ="50" width="524" height="10" fill="1"/>
        <drawCenteredString x="297" y="25">Page <pageNumber/></drawCenteredString>
	</pageGraphics>
	<frame id="first" x1="1in" y1="1in" width="6.27in" height="9.69in"/>
	</pageTemplate><pageTemplate id="landscape" pageSize="(842,595)">
		<frame id="first" x1="1in" y1="1in" height="6.27in" width="9.69in"/>
	</pageTemplate>

	<pageTemplate id="alt">
	<pageGraphics>
        <fill color="cyan"/>
		<setFont name="Helvetica-BoldOblique" size="18"/>
		<drawRightString x="523" y="820">RML2PDF Test Suite - Test #16</drawRightString>
        <rect x="36" y ="800" width="524" height="10" fill="1"/>
        <rect x="36" y ="50" width="524" height="10" fill="1"/>
        <drawCenteredString x="297" y="25">Page <pageNumber/></drawCenteredString>
	</pageGraphics>
	<frame id="first" x1="1in" y1="1in" width="6.27in" height="9.69in"/>
	</pageTemplate>

	<pageTemplate id="maskout">
    <pageGraphics></pageGraphics>
	<pageGraphics>
        <fill color="white"/>
        <rect x="0" y ="800" width="595" height="42" fill="1" stroke="0"/>
        <rect x="0" y ="0" width="595" height="50" fill="1" stroke="0"/>
        <fill color="cyan"/>
		<setFont name="Helvetica-BoldOblique" size="18"/>
		<drawRightString x="523" y="820">RML2PDF Test Suite - Test #16</drawRightString>
        <rect x="36" y ="800" width="524" height="10" fill="1"/>
        <rect x="36" y ="50" width="524" height="10" fill="1"/>
        <drawCenteredString x="297" y="25">Page <pageNumber/></drawCenteredString>
	</pageGraphics>
	<frame id="first" x1="1in" y1="1in" width="6.27in" height="9.69in"/>
	</pageTemplate>

    
    
</template>

<stylesheet>
	<initialize>
	<alias id="style.normal" value="style.Normal"/>
	</initialize>

	<paraStyle name="h1"
	fontName="Helvetica-Bold"
	fontSize="14"
    leading="17"
	spaceBefore = "28"
	/>

	<paraStyle name="body"
	fontName="Helvetica"
	fontSize="12"
    leading="14"
	spaceBefore = "14"
	/>
    
	<paraStyle name="code"
	fontName="Courier"
	fontSize="10"
    leading="12"
	spaceBefore = "0"
    leftIndent="36"
    textColor="navy"
	/>

		
</stylesheet>


<story>
<outlineAdd>Front Page</outlineAdd>
<para style="h1">PageCatcher integration tests</para>
<para style="body">This page tests out a number of tags added to make it
easier to use PageCatcher templates. </para>

<para style="body">It is important to see how these interact with the page template.
So, this document has a purple stripe and text at top and bottom which is part of
the template. </para>


<para style="body">First and foremost is <font face="Courier" color="navy">&lt;includePdfPages filename="filename.pdf" pages="1,2,7-12"/&gt;</font>. This tag slurps in PDF pages into the current document.  It begins by
outputting a page break, and leaves you "on the final page" it draws.</para>

<para style="body">By default the imported PDF file will probably be drawn "over the top" 
of the current page template.  So, if you have a header or footer defined in a page template, and
the imported page does too, the imported one will draw over it and not vice versa. See the 
examples on the next few pages.</para>

<para style="body">However, if your page template defines TWO pagegraphics sections
instead of one, the second one will be drawn AFTER any flowing content, which includes
the imported pages.  So, you can use a second pageGraphics section to mask out
headers and footers in the imported forms if you really need to.</para>


<para style="body">The engine will output a page break BEFORE the first new
page, and leave you on the same page as the last imported one.  
This behaviour was chosen carefully to facilitate template switching.  Commonly one has a standard
header or footer running through a document, but may want to suppress or change it
when including pages from other applications.  You can precede includePages with a template
change action, for example, 
<font face="Courier" color="navy">&lt;setNextTemplate name="alt"&gt;</font>.
This will mean that your new template is used for each page on which an included
PDF is drawn.  If you don't want one, define a template called 'blank' with one
frame for content and no decorations.</para>

<para style="body">After including pages, you will be left "at the top of" the last
PDF page.  You could therefore flow paragraphs over the top of it if you want.
However, the most common use is simply to follow 
  <font face="Courier" color="navy">&lt;includePdfPages&gt;</font>
with 
  <font face="Courier" color="navy">&lt;nextFrame&gt;</font>
to move to the next page.  Or, with 
<font face="Courier" color="navy">&lt;setNextTemplate&gt;</font>
and then <font face="Courier" color="navy">&lt;nextFrame&gt;</font>
to change back to your original page template for the next page.
</para>

<para style="body">The "pages" attribute can be omitted to import all pages,
or can take strings like "<font face="Courier" color="navy">1</font>", 
"<font face="Courier" color="navy">1,2,3-5</font>" etc. </para>

<para style="body">The next two pages show a UK Inland Revenue form,
and also show switching to a different cyan-coloured template.</para>


<setNextTemplate name="alt"/>
<includePdfPages 
    filename="../../pageCatcher/test/ir684.pdf" 
    pages="1-2"
    outlineText="IR684 with both pages"/>

<setNextTemplate name="main"/>
<nextFrame/>

<para>The preceding 2 pages should have been the tax form.  And I should now be on page <pageNumber/>!
Let's add the same one again to check it does not complain:
</para>
<includePdfPages 
    filename="../../pageCatcher/test/ir684.pdf" 
    pages="1"
    outlineText="IR684 again, one page"
    />
<para>Now we add page 1 at 90 180 and 270
</para>
<includePdfPages 
    filename="../../pageCatcher/test/ir684.pdf" 
    pages="1"
    outlineText="IR684 again, one page orientation=90"
	orientation="90"
	template="landscape"
    />
<includePdfPages 
    filename="../../pageCatcher/test/ir684.pdf" 
    pages="1"
    outlineText="IR684 again, one page orientation=180"
	orientation="180"
	template="main"
    />
<includePdfPages 
    filename="../../pageCatcher/test/ir684.pdf" 
    pages="1"
    outlineText="IR684 again, one page orientation=270"
	orientation="270"
	template="landscape"
    />
<setNextTemplate name="main"/>
<nextFrame/>

<para>Finally, we will show how the use of a second pageGraphics tags lets us mask
over annoying headers and footers. Compare the mess at the bottom of page 5 with
the cleaner version on page 7.
</para>
<setNextTemplate name="maskout"/>
<includePdfPages 
    filename="../../pageCatcher/test/ir684.pdf" 
    pages="1"
    outlineText="IR684 again, masked"
    />


</story>
</document>
