Script - Custom layout

Sample custom layout. This script can put many short pages onto one long paper.

local doc=window.GetDocument();
local count=doc.numpages;
local i;
for(i=0;i<count;i++)
{
	local page=doc.GetPage(i);
	local r= page.AutoCrop();
	if(r)
		page.SetCrop(r);
}

layout.Clear();
local paper;
local rest=0.0;
local y=0;
local delta=0.5;

for(i=0;i<count;i++)
{
	local page=doc.GetPage(i);
	local p1 = page.GetAreaSize();
	p1.y+=delta;
	if(p1.y>rest){
		paper=layout.NewSheet();
		y=0;
		rest=paper.GetArea().Height();
		//print("New Sheet:"+rest+"\n");
	}
	rest-=p1.y;
	//print("Page:"+p1.y+"  ,remaining:" +rest+"\n");
	paper.InsertPage(page);	
	paper.SetPagePos(page,Point(0,y));
	paper.SetPageScale(page,1.0);
	y+=p1.y;
}

See Results:

Custom Layout

All samples