<!DOCTYPE document SYSTEM "rml_1_0.dtd"> 
<document filename="test_006_barcodes.pdf">

  <docinit>
    <registerTTFont faceName="Vera" fileName="Vera.ttf" />
    <registerTTFont faceName="VeraBold" fileName="VeraBd.ttf" />
    <registerTTFont faceName="VeraItalic" fileName="VeraIt.ttf" />
  </docinit>

<template pageSize="(595, 842)" leftMargin="72" showBoundary="1">
	<pageTemplate id="main">
	<pageGraphics>
		    <setFont name="Helvetica-Bold" size="18"/>
		    <drawString x="35" y="783">RML Example 11: Barcodes</drawString>
			<image file="logo_no_bar.png" preserveAspectRatio="1" x="488" y="749" width="72" height="72"/>
    		<image file="strapline.png" preserveAspectRatio="1" x="35" y="0" width="525" />
		</pageGraphics>
	<frame id="second" x1="35" y1="45" width="525" height="590"/>
	</pageTemplate>
	
	<pageTemplate id="main2" pageSize="a4 portrait">
		<pageGraphics>
		  <setFont name="Helvetica-Bold" size="18"/>
		    <drawString x="35" y="783">RML Example 11: Barcodes</drawString>
			<image file="logo_no_bar.png" preserveAspectRatio="1" x="488" y="749" width="72" height="72"/>
    		<image file="strapline.png" preserveAspectRatio="1" x="35" y="0" width="525" />  
		</pageGraphics>
		
		<frame id="second" x1="35" y1="45" width="525" height="685"/>
	</pageTemplate>
</template>

<stylesheet>
	<initialize>
		<alias id="style.normal" value="style.Normal"/>
	</initialize>
    <paraStyle name="h1" fontName="VeraBold" fontSize="12" spaceBefore="12" leading="15"/>
    <paraStyle name="normal" fontName="Vera" fontSize="10" spaceBefore="6" leading="12"/>
    <paraStyle name="intro"  fontName="Helvetica" fontSize="12" leading="12" spaceAfter="12"/>
    <paraStyle name="code" fontName="Courier" fontSize="8" leading="10" textColor="navy" spaceBefore="12"/>
	<blockTableStyle id="temp001">
		<blockAlignment value="left"/>
		<blockFont name="Helvetica-Oblique"/>
		<lineStyle kind="GRID" colorName="black"/>
		<lineStyle kind="OUTLINE" colorName="black" thickness="2"/>
	</blockTableStyle>
</stylesheet>

<story>
<storyPlace x="35" y="660" width="525" height="73" origin="page">
<para style="intro">RML (Report Markup Language) is ReportLab's own language for specifying the appearance of a printed page, which is converted into PDF by the utility rml2pdf.</para>
<hr color="white" thickness="8pt"/>
<para style="intro">These RML samples showcase techniques and features for generating various types of ouput and are distributed within our commercial package as test cases. Each should be self explanatory and stand alone.</para>
<illustration height="3" width="525" align="center">
<fill color= "(0,0.99,0.97,0.0)" />
<rect x="0" y = "-12" width="525" height="3" round="1" fill="1" stroke = "Yes" />
</illustration>
</storyPlace>

    <para style="h1">Barcode support in RML</para>
	<para style="normal">
		This shows a few different barcodes and the techniques for using them.   There are two tags which can be used and the source for this test file shows both.  The first is a graphics tag which can be used in an &lt;illustration&gt; tag, and thus positioned at the precise location of your choice...
	</para>
		
	<xpre style="code">
&lt;barcode x="1cm" y="1cm" code="Code128"&gt;AB-123456&lt;/barcode&gt;
   </xpre>

	<para style="normal">
		The second technique is a 'flowable' tag which can be used within the story, and thus placed between two paragraphs with ease.
	</para>
		
	<xpre style="code">
&lt;barCodeFlowable code="Standard39" value="PFWZF" barWidth="0.01in" quiet="no"/&gt;
   </xpre>
		
	<para style="normal">
		Currently we support these attributes for the 'code' attribute in both tags:
		
		( I2of5 | Code128 | Standard93 | Extended93 |
        Standard39 | Extended39 | MSI | Codabar |
        Code11 | FIM | POSTNET | USPS_4State | EAN8 | EAN13 | QR)
	</para>

	<para style="normal">
	    There are many other attributes defined in the rml.dtd file, but in general barcodes know how to draw themselves at the correct size, and if you are using a specific code you will know which ones apply to you.
	</para>


	<para style="normal">
		Code11
	</para>

	<illustration width="10cm" height="1cm">
		<barCode x="1cm" y="0" code="Code11">01234545634563</barCode>
	</illustration>
	
	<spacer length="1cm"/>
	<para style="normal">Code128</para>
	<illustration width="10cm" height="1cm">
		<barCode x="1cm" y="0" code="Code128">AB-12345678</barCode>
	</illustration>

	<spacer length="1cm"/>
	<para style="normal">Code128 with some custom settings</para>
	<illustration width="10cm" height="2cm">
		<barCode x="1cm" y="0" code="Code128" barHeight="0.5in" barWidth="0.009in">AB-12345678</barCode>
	</illustration>
	
	
	<para style="normal">A bar chart flowable tag should appear after this paragraph in "Standard39" code.  It works out its height so if you need space before and after, use the "spacer" tag.</para>
    <barCodeFlowable code="Standard39" value="PFWZF" barWidth="0.01in" quiet="no"/>
	<para style="normal">More on the next page</para>
	<setNextTemplate name="main2"/>

    <nextPage/>
	<para style="h1">EAN13  - European Article Number with 13 digits</para>
	<para style="normal">These have a natural size of approx 3.8cm x 2.8cm, which is the one on the left.  Since these are graphical tags, if you need it a bit bigger or smaller then the safest approach is to use the RML 'scale' tag to uniformly scale up or down the widget.  You may also tweak the size by adjusting the barWidth, barHeight and spaceWidth properties but ensure you do test scans if using any 'unnatural' size; the two cases on the right have been tweaked in this way.  </para>
	<illustration width="15cm" height="6cm">
		<barCode x="0cm" y="0cm" code="EAN13">123456789012</barCode>
		<barCode x="5cm" y="0cm" code="EAN13" barHeight="5cm">2222222222222</barCode>
		<barCode x="10cm" y="0cm" code="EAN13" barWidth="1.5">3333333333333</barCode>
	</illustration>


    <para style="normal">Here's the 'flowable' version of the same code...it should look like the one on the left above</para>
    <barCodeFlowable code="EAN13" value="123456789012"/>

    <para style="normal">And here's one in the shorter EAN8...</para>
    <barCodeFlowable code="EAN8" value="12345678"/>

    <para style="normal">QR 2d barcode contributed by Germ&aacute;n M. Bravo &lt;german.mb@gmail.com&gt;</para>
    <barCodeFlowable code="QR" value="QR 2d barcode contributed by Germ&aacute;n M. Bravo &lt;german.mb@gmail.com&gt;"/>

</story>

</document>
