Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

RML image tag in printing duplicate (repeated) images in pdf in multiple pages

By
rais
on 3/17/15, 9:49 PM 1,724 views

Below is my code, when I execute it will print the images in first and second page. But I only needed in the first page. May be I am missing some clear floating similar to html/css here? Thank you in advance.

EDIT No. 1: If I removed [[repeatIn(objects,'o')]] then it will print one page only. But I still need second page but without the images.

EDIT No. 2: After comments from "scot77844", it does not print image when I put "Images" inside "story" and "repeatIn". In addition when I added new page/s (similar to page 1 & 2 code below) then image does not print in pages 3, 4, or so on. Anywhere I can understand what's going behind RML2PDF here? A bit strange or may be my method is wrong here? 

 <?xml version="1.0"?>
<document filename="Sales Order Quotation.pdf">
	
  <template title="Sales Order Quotation" author="DCS" allowSplitting="20" showBoundary="0"  pageSize="(8.5in,11in)">
    <pageTemplate id="page1">
		<frame id="header1" x1="11.0cm" y1="28cm"  height="1.0cm" width="9.0cm"/>    
	    <frame id="p1_first" x1="25.0" y1="3cm" width="545" height="640" borderWidth="1"/>  

	   <pageGraphics>
			<image x="0.8cm" y="28.0cm" height="30.0">[[company.logo or removeParentNode('image')]]</image>
			<image file="addons/mymodule/report/images/lightweight.png"  x="1.2cm" y="17.0cm" height="30" width="30"/>
			<image file="addons/mymodule/report/images/snap.png"  x="1.2cm" y="15.5cm" height="30"  width="30"/>
			<image file="addons/mymodule/report/images/waterproof.png"  x="1.2cm" y="14.0cm" height="30"  width="30"/>
			<image file="addons/mymodule/report/images/quality.png"  x="1.2cm" y="12.5cm" height="30"  width="30"/>
			<image file="addons/mymodule/report/images/support.png"  x="1.2cm" y="11.0cm" height="30"  width="30"/>
			<image file="addons/mymodule/report/images/easy.png"  x="1.2cm" y="9.5cm" height="30"  width="30"/>
			<image file="addons/mymodule/report/images/environment.png"  x="1.2cm" y="8.0cm" height="30"  width="30"/>
			
			<place x="1.0cm" y="26.02cm" height="1.8cm" width="15.0cm">
				<para fontSize="7.0" fontName="Helvetica" spaceBefore="0" spaceAfter="0">[[ display_address(company.partner_id) or  '' ]] </para>
				<para fontSize="7.0" fontName="Helvetica" spaceBefore="0" spaceAfter="0">P: xxx F: xxx E: xxx</para>
				 
			</place>
			<lines>0.8cm 26.0cm 8.09cm 26.0cm</lines>
			<lines>0.8cm 27.97cm 20.09cm 27.97cm</lines>
			<lines>1.0cm 2.5cm 20.0cm 2.5cm</lines>
			<place x="1.0cm" y="0.3cm" height="1.8cm" width="19.0cm">
				<para fontSize="7.0" fontName="Helvetica" alignment="CENTER">xxx</para>
				<para fontSize="7.0" fontName="Helvetica" alignment="RIGHT">Page: <pageNumber/> of 5</para>
			</place>
			 
		</pageGraphics>
    </pageTemplate>
	
	
	<pageTemplate id="page2">
	
	   <frame id="header2" x1="11.0cm" y1="28cm"  height="1.0cm" width="9.0cm"/>    
	   <frame id="p2_first" x1="25.0" y1="3cm" width="545" height="640"/>  

	   <pageGraphics>
			<image x="0.8cm" y="28.0cm" height="30.0">[[company.logo or removeParentNode('image')]]</image>
			<place x="1.0cm" y="26.02cm" height="1.8cm" width="15.0cm">
				<para fontSize="7.0" fontName="Helvetica" spaceBefore="0" spaceAfter="0">[[ display_address(company.partner_id) or  '' ]] 
				
				</para>
				<para fontSize="7.0" fontName="Helvetica" spaceBefore="0" spaceAfter="0">P: xxx F: xxx E: xxx</para>
				 
			</place>
			<lines>0.8cm 26.0cm 8.09cm 26.0cm</lines>
			<lines>0.8cm 27.97cm 20.09cm 27.97cm</lines>
			<lines>1.0cm 2.5cm 20.0cm 2.5cm</lines>
			<place x="1.0cm" y="0.3cm" height="1.8cm" width="19.0cm">
				<para fontSize="7.0" fontName="Helvetica" alignment="CENTER">xxx</para>
				<para fontSize="7.0" fontName="Helvetica" alignment="RIGHT">Page: <pageNumber/> of 5</para>
			</place>
			 
		</pageGraphics>
	</pageTemplate>

  </template>
  <stylesheet/>
  <story>
	[[repeatIn(objects,'o')]]
	[[ setLang(o.partner_id.lang) ]]
	
		<!-- START OF PAGE 1 -->
		<setNextTemplate name="page1"/>
		<para alignment="RIGHT"><b>Quotation #[[ o.name ]]</b> DATE: <b>[[ o.date_order ]]</b></para>
		<spacer length="0.3cm"/>	
		 

		<!-- END OF PAGE 1 -->

		<!-- START OF PAGE 2 -->
		<condPageBreak height="700"/>
		<setNextTemplate name="page2"/>
		<para alignment="RIGHT"><b>Quotation #[[ o.name ]]</b> DATE: <b>[[ o.date_order ]]</b></para>
		<spacer length="0.3cm"/>	



		<!-- END OF PAGE 2 -->
	  
	   
  </story>
</document>
            
            
            
            
            
            
            
0
scot77844
On 3/18/15, 7:57 AM

Hi Rais,

Include Image tags in between the lines <story> and [[repeatIn(objects,'o')]], instead of in the page template and try once. May be it will work.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/17/15, 9:49 PM
Seen: 1724 times
Last updated: 3/18/15, 6:50 PM