diff -u -r -N ./impositionplan.cpp /home/deter/temp/podofo-0.8.0/tools/podofoimpose//impositionplan.cpp
--- ./impositionplan.cpp	2010-05-07 12:26:38.000000000 +0200
+++ /home/deter/temp/podofo-0.8.0/tools/podofoimpose//impositionplan.cpp	2010-05-07 13:59:21.000000000 +0200
@@ -42,6 +42,45 @@
 
 #include <iostream> //XXX
 namespace PoDoFo { namespace Impose {
+
+LineRecord::LineRecord ( int d, double x1, double y1, double x2, double y2, const char *pszStyle )
+	: destPage(d),
+	startX(x1),
+	startY(y1),
+	endX(x2),
+	endY(y2) 
+{
+	//Taken from PdfPainter::SetStrokeStyle
+	if (!strcasecmp(pszStyle,"Solid") )
+		style="[] 0";
+	else if (!strcasecmp(pszStyle,"Dash") )
+		style="[3] 0";
+	else if (!strcasecmp(pszStyle,"Dot") )
+		style="[1] 0";
+	else if (!strcasecmp(pszStyle,"DashDot") )
+		style="[3 1 1] 0";
+	else if (!strcasecmp(pszStyle,"DashDotDot") )
+		style="[3 1 1 1 1] 0";
+	else
+		style=pszStyle;
+}
+
+LineRecord::LineRecord() 
+	: destPage(0),
+	startX(0),
+	startY(0),
+	endX(0),
+	endY(0),
+	style("[] 0")
+{
+}
+
+bool LineRecord::isValid() const
+{
+	//TODO: check page boundaries, line style?
+	return destPage && (startX!=endX || startY!=endY);
+}
+
 PageRecord::PageRecord ( int s,int d,double r, double tx, double ty, int du )
 		: sourcePage ( s ),
 		destPage ( d ),
diff -u -r -N ./impositionplan.h /home/deter/temp/podofo-0.8.0/tools/podofoimpose//impositionplan.h
--- ./impositionplan.h	2010-05-07 12:26:38.000000000 +0200
+++ /home/deter/temp/podofo-0.8.0/tools/podofoimpose//impositionplan.h	2010-05-07 13:49:38.000000000 +0200
@@ -74,6 +74,21 @@
 		}
 };
 
+/**
+  @author Deter de Wet
+For (cut)lines on output pages.
+ */
+class LineRecord
+{
+	public:
+		LineRecord ( int dPage, double x1, double y1, double x2, double y2, const char *pszStyle );
+		LineRecord();
+		~LineRecord() { };
+		int destPage;
+		double startX,startY,endX,endY;
+		std::string style;
+		bool isValid() const;
+};
 
 /**
   @author Pierre Marchand <pierre@moulindetouvois.com>
@@ -111,6 +126,9 @@
 		std::map<std::string, std::string> vars;
 		
 		const SourceVars sourceVars;
+		
+		// for (cut)lines
+		std::vector<LineRecord> lines;
 
 	private:
 		double m_destWidth;
diff -u -r -N ./pdftranslator.cpp /home/deter/temp/podofo-0.8.0/tools/podofoimpose//pdftranslator.cpp
--- ./pdftranslator.cpp	2010-05-07 12:26:38.000000000 +0200
+++ /home/deter/temp/podofo-0.8.0/tools/podofoimpose//pdftranslator.cpp	2010-05-07 14:23:47.000000000 +0200
@@ -377,6 +377,10 @@
 // 	std::cerr <<"Plan completed "<< planImposition.size() <<endl;
 
 		}
+		struct PlateElements {
+			vector<PageRecord> pages;
+			vector<LineRecord> lines;
+		};
 
 		void PdfTranslator::impose()
 		{
@@ -408,13 +412,16 @@
 				}
 			}
 
-			typedef map<int, vector<PageRecord> > groups_t;
+			typedef map<int, PlateElements > groups_t;
 			groups_t groups;
 			for ( unsigned int i = 0; i < planImposition->size(); ++i )
 			{
-				groups[ ( *planImposition ) [i].destPage].push_back ( ( *planImposition ) [i] );
+				groups[ ( *planImposition ) [i].destPage].pages.push_back ( ( *planImposition ) [i] );
+			}
+			for ( unsigned int i = 0; i < planImposition->lines.size(); ++i )
+			{
+				groups[ planImposition->lines[i].destPage].lines.push_back (  planImposition->lines[i] );
 			}
-			
 			unsigned int lastPlate(0);
 			groups_t::const_iterator  git = groups.begin();
 			const groups_t::const_iterator gitEnd = groups.end();
@@ -435,9 +442,9 @@
 				// Scale
 				buffer << std::fixed << scaleFactor <<" 0 0 "<< scaleFactor <<" 0 0 cm\n";
 
-				for ( unsigned int i = 0; i < git->second.size(); ++i )
+				for ( unsigned int i = 0; i < git->second.pages.size(); ++i )
 				{
-					PageRecord curRecord ( git->second[i] );
+					PageRecord curRecord ( git->second.pages[i] );
 // 					std::cerr<<curRecord.sourcePage<< " " << curRecord.destPage<<std::endl;
 					if(curRecord.sourcePage <= pcount)
 					{
@@ -489,6 +496,15 @@
 				string bufStr = buffer.str();
 				newpage->GetContentsForAppending()->GetStream()->Set ( bufStr.data(), bufStr.size() );
 				newpage->GetResources()->GetDictionary().AddKey ( PdfName ( "XObject" ), xdict );
+				PdfPainter painter;
+				painter.SetPage( newpage );
+				for ( unsigned int i = 0; i < git->second.lines.size(); ++i )
+				{
+					LineRecord curRecord ( git->second.lines[i] );
+					painter.SetStrokeStyle ( ePdfStrokeStyle_Custom, curRecord.style.c_str() );
+					painter.DrawLine( curRecord.startX, curRecord.startY, curRecord.endX, curRecord.endY );
+				}
+				painter.FinishPage();
 				++git;
 			}
 
diff -u -r -N ./planreader_lua.cpp /home/deter/temp/podofo-0.8.0/tools/podofoimpose//planreader_lua.cpp
--- ./planreader_lua.cpp	2010-05-07 12:26:38.000000000 +0200
+++ /home/deter/temp/podofo-0.8.0/tools/podofoimpose//planreader_lua.cpp	2010-05-07 14:24:36.000000000 +0200
@@ -46,6 +46,7 @@
 }
 
 PlanReader_Lua::PlanReader_Lua(const std::string & planfile, PoDoFo::Impose::ImpositionPlan * ip)
+	: currentLineStyle("Solid")
 {
 // 	std::cerr<<"PlanReader_Lua::PlanReader_Lua "<< planfile <<std::endl;
 	plan = ip;
@@ -53,6 +54,9 @@
 	lua_pushcfunction(L.State(), &PlanReader_Lua::PushRecord);
 	lua_setglobal(L.State(), "PushRecord");
 	
+	lua_pushcfunction(L.State(), &PlanReader_Lua::PushLine);
+	lua_setglobal(L.State(), "PushLine");
+	
 	lua_pushlightuserdata(L.State(), static_cast<void*>(this));
 	lua_setglobal(L.State(), "This"); 
 	
@@ -119,6 +123,48 @@
 	
 	return 0;
 }
+
+int PlanReader_Lua::PushLine ( lua_State * L )
+{
+	/* TODO: check stack for space! 
+	I would be glad to do that, but I don’t know how - pm
+	*/
+	if ( ! ( lua_isnumber ( L, 1 ) &&
+	         lua_isnumber ( L, 2 ) &&
+	         lua_isnumber ( L, 3 ) &&
+	         lua_isnumber ( L, 4 ) &&
+	         lua_isnumber ( L, 5 ) &&
+	         ( lua_isnoneornil (L, 6) || lua_isstring ( L, 6 ) ) ) )
+	{
+		throw std::runtime_error ( "Invalid arguments to PushLine" );
+	}
+
+	/* Get the instance of the reader which runs the script */
+	lua_getglobal ( L , "This" );
+	if ( ! lua_islightuserdata ( L, -1 ) )
+		throw std::runtime_error ( "\"This\" is not valid" ); // ;-)
+	PlanReader_Lua *that = static_cast<PlanReader_Lua*> ( lua_touserdata ( L, -1 ) );
+	lua_pop ( L, 1 );
+
+// 	std::cerr<<"PlanReader_Lua::PushRecord "<<lua_tonumber ( L, 1 )<<" "<<lua_tonumber ( L, 2 )<<" "<<lua_tonumber ( L, 3 )<<" "<<lua_tonumber ( L, 4 )<<" "<<lua_tonumber ( L, 5 )<<std::endl;
+	
+	/* and add a new record to it */
+	if (!lua_isnoneornil ( L, 6 ) )
+		that->currentLineStyle = lua_tostring ( L, 6);
+	PoDoFo::Impose::LineRecord LR(
+	                            lua_tonumber ( L, 1 ),
+	                            lua_tonumber ( L, 2 ),
+	                            lua_tonumber ( L, 3 ),
+	                            lua_tonumber ( L, 4 ),
+	                            lua_tonumber ( L, 5 ),
+	                            that->currentLineStyle.c_str() );
+	if(LR.isValid())
+		that->plan->lines.push_back ( LR );
+
+	lua_pop ( L,  lua_gettop ( L ) );
+	
+	return 0;
+}
 
 double PlanReader_Lua::getNumber(const std::string & name)
 {
diff -u -r -N ./planreader_lua.h /home/deter/temp/podofo-0.8.0/tools/podofoimpose//planreader_lua.h
--- ./planreader_lua.h	2010-05-07 12:26:38.000000000 +0200
+++ /home/deter/temp/podofo-0.8.0/tools/podofoimpose//planreader_lua.h	2010-05-07 13:14:39.000000000 +0200
@@ -43,9 +43,11 @@
 		~PlanReader_Lua();
 		
 		static int PushRecord(lua_State *L);
+		static int PushLine(lua_State *L);
 		
 	private:
 		PoDoFo::Impose::ImpositionPlan* plan;
+		std::string currentLineStyle;
 		
 		/** Ask if a variable is available in script global scope */
 		bool hasGlobal(const std::string& name);
diff -u -r -N ./plans/lua/BookletCut.plan /home/deter/temp/podofo-0.8.0/tools/podofoimpose//plans/lua/BookletCut.plan
--- ./plans/lua/BookletCut.plan	1970-01-01 02:00:00.000000000 +0200
+++ /home/deter/temp/podofo-0.8.0/tools/podofoimpose//plans/lua/BookletCut.plan	2010-05-07 16:16:23.000000000 +0200
@@ -0,0 +1,44 @@
+-- Impose portrait booklets to a single A4 page which has to be cut 
+-- Adapted from Booklet.plan
+print("Booklet")
+-- We output an A4 page for an A5 booklet after cutting
+PageWidth = 595.27559
+PageHeight = 841.88976
+-- We assume portrait source pages
+Scale=PageWidth/(2*SourceWidth)
+rot=0
+xof=SourceWidth
+yof=SourceHeight
+
+do
+	rest = PageCount % 8
+	totp = PageCount	
+	if rest ~= 0 then
+		totp = totp + 8 - rest
+	end	
+	imax = totp / 4
+	count = 1
+	inc = 0
+	print(PageCount,imax,totp)
+	while count <= imax
+		do
+-- 		We assume that podofoimpose will discard invalid records
+-- 		Recto
+			--print(totp - inc, count, rot, 0, yof)
+		  PushRecord(totp - inc , count , rot, 0 , yof)
+			--print(inc + 1, count, rot, xof, yof)
+		  PushRecord(inc + 1 , count , rot, xof , yof)
+		  PushLine(count, 0, yof, SourceWidth*2, yof, "Dash")
+		  inc = inc + 2
+		  PushRecord(totp - inc , count , rot, 0 , 0)
+		  PushRecord(inc + 1 , count , rot, xof , 0)
+		  count = count + 1
+-- 		Verso
+		  PushRecord(inc , count, rot, 0, yof)
+		  PushRecord(totp-inc+1 , count, rot, xof, yof)
+		  inc = inc + 2
+		  PushRecord(inc , count, rot, 0, 0)
+		  PushRecord(totp-inc+1 , count, rot, xof, 0)
+		  count = count + 1
+		end
+end 
\ No newline at end of file
diff -u -r -N ./README.html /home/deter/temp/podofo-0.8.0/tools/podofoimpose//README.html
--- ./README.html	2010-05-07 12:26:38.000000000 +0200
+++ /home/deter/temp/podofo-0.8.0/tools/podofoimpose//README.html	2010-05-07 15:48:05.000000000 +0200
@@ -141,6 +141,13 @@
 	      </div>
 		As for regular plan files, there are a couple of provided informations through global variables, specifically: "SourceWidth", "SourceHeight", "PageCount". You need to set "PageWidth" and "PageHeight". You may alter the global scale factor (from source to target) by setting "Scale".
 	     </div>
+	    <div>
+	     Lua plan files also support the ability to draw arbitrary lines on the output pages. This is useful for generating cut lines / marks. The command to use is: 
+	     <div class="command">
+	      PushLine(target page, x1, y1, x2, y2[, DashPattern]);
+	      </div>
+			x1,y1,x2,y2 are numbers giving the coordinates of the start and end of the line. These numbers are scaled by the global scale factor. DashPattern must be a string with one of the values "Solid","Dash","DashDot","DashDotDot" (all case-insensitive) or a valid PDF line pattern string (see the PDF specification). If DashPattern is omitted, the last set value is used, or "Solid" if no value has been set yet. See plans/lua/BookletCut.plan for an example.  
+	     </div>
 		<h4>Running</h4>
 		 <div>
 		  There is no format detection mechanism, so you need to append "lua" keyword to podofoimpose invocation when you want it to process a Lua script.
