Scrpt - Custom layout

Custom layout

Fixed Layout with 3 pages.

Number of pages per paper is fixed, so we can start with 3x1 layout.
This will turn layout into 3 pages per sheet mode. After that we can change scale and position of pages so first page will be large and located on the left, next ones are one the right.

 

 

layout.SetLayout(3,1);// put 3 pages on one sheet

local npapers=layout.GetNumSheets();
for(local iPaper=0;iPaper<npapers;iPaper++)
{
	local paper=layout.GetSheet(iPaper);
	local size=paper.GetSize();
	local area=paper.GetArea();
	local count=paper.GetNumPages();

	local Xstart,w,h;
	for(local i=0;i<count;i++)
	{
		local page=paper.GetPage(i);
		local p1 = page.GetAreaSize();
		switch(i)
		{
		case 0:{ // big page
			paper.SetPagePos(i,Point(0,0));
			h=area.Height();
			local ky= h/p1.y;
			paper.SetPageScale(i,ky);
			Xstart=p1.x*ky+layout.hSeparator;
			w=area.Width()-Xstart;
			h/=2;
			   }break;
		case 2:
		case 1:{ // small pages
			//page.angle=3;
			//local p1 = page.GetAreaSize();
			local ky= (h-layout.vSeparator)/p1.y;
			local kx= w/p1.x;
			if(kx<ky)ky=kx;
			paper.SetPageScale(i,ky);
			p1*=ky;
			local y=0;
			if(i==2)y=h;
			paper.SetPagePos(i,Point(Xstart+(w-p1.x)/2, y+(h-p1.y)/2));	
			   }break;
		}
	}
}

 

All samples