🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #2184

Re: COMBINE 3 INDESIGN PAGES INTO I

#2184
From: loic_aigon
Date: Sat, 10 Jan 2009 23:41
70 lines
2706 bytes
Hi I tried something. Let me know if it helped.
Loic

if(app.documents.length!=0)
{
	try
	{
		//Get Postcard doc attributes
		var doc= app.documents[0].getElements()[0];
		var docFile = File(doc.fullName);
		var docName = doc.name.split(".indd")[0];
		var docFolder = Folder(docFile.parent);

		//Add a temporary document & set dimensions
		var tempdoc = app.documents.add();
		with(tempdoc)
		{
			documentPreferences.pageWidth="8.5";
			documentPreferences.pageHeight="11";
		}



		//Create the imported document first's recipient & place the page 1 of the postcard document
		var r1 = tempdoc.rectangles.add({geometricBounds:[0.75,1.1875,5.125,7.3125]});
		app.importedPageAttributes.pageNumber = 1;
		r1.place(docFile,false);
		fitMe(r1);

		//Create the imported document second's recipient & place the page 2 of the postcard document
		var r2 = tempdoc.rectangles.add({geometricBounds:[5.2525,1.1875,9.6345,7.3125]});
		app.importedPageAttributes.pageNumber = 2;
		r2.place(docFile,false);
		fitMe(r2);

		//Create a text frame for other infos
		var r3 = tempdoc.textFrames.add({contents:"Please Fax us back your approval as soon as possible at 555-8000-210",geometricBounds:[9.8325,1.1875,10.5,7.3125]});

		//Export to PDF and display the created file		
		var myPDFfile = docFolder+"/"+docName+".pdf";
		app.pdfExportPreferences.viewPDF = true;
		exportPDF(myPDFfile,"[PDF/X-1a:2001]",tempdoc);

		//Close the temporary document without saving it.
		tempdoc.close (SaveOptions.NO, undefined, undefined, false);
	}
	catch(e)
	{
		//In case of a error...
		alert(e);
	}
}
else
{
	alert("You don't have any Indesign documents open !");
}

//Quite obvious function
function exportPDF(myPdfFile,myPdfPreset,doc)
{
	doc.exportFile (ExportFormat.PDF_TYPE, myPdfFile, false, myPdfPreset, undefined, undefined, false);
}

//Fit placed documents into the recipients
function fitMe(monObjet)
{
	monObjet.fit(FitOptions.PROPORTIONALLY);
	monObjet.fit(FitOptions.CENTER_CONTENT);
	monObjet.fit(FitOptions.FRAME_TO_CONTENT);
}
Technical Details
Message-ID: <59b77908.0@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing
References: <59b77908.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,20da3f01caf9e1
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: loic_aigon <loic_aigon@yahoo.fr>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: COMBINE 3 INDESIGN PAGES INTO I
Message-ID: <59b77908.0@webcrossing.la2eafNXanI>
Date: Sat, 10 Jan 2009 15:41:48 -0800
References: <59b77908.-1@webcrossing.la2eafNXanI>
Lines: 76
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit