Some developers working with Bundler SDK reported an issue where they were getting errors, while setting SmoothScrollingOptions in a Folio to be exported, using exportMiniFolio() method.

Following is a script to set/include SmoothScrollingOptions enum's value , while exporting to a folio.

Below code shows how you can use this :

app.exportMiniFolio(
		f, docs[0], docs[1], folioMetadata,
		[
			[ "widedimension", 1024 ],
			[ "narrowdimension", 768 ],
			[ "assetformat", "png" ],
			[ "tocimagefile",File("/c/temp/bundler/input/BundlerSDK_Folio/Adobe_Stack/tocPreview.png") ],
			[ "fpoassetdirectory",File("/c/temp/bundler/input/OverlayResources")],
            ["smoothscrolling", SmoothScrollingOptions.noSmoothScroll],
			[ "contentstackid", "SimpleExampleID" ]
		]
	);

Here is the full script, just to avoid any confusion about the parameters used in above function call.

function getFilenameForDoc(doc)
{
	return (new File(doc.fullName)).name;
}

function getLastCharOfName(doc)
{
	var name = getFilenameForDoc(doc);
	var dot = name.lastIndexOf(".");
		
	return (dot > 0) ? name.charAt(dot - 1) : "";
}

function getDocuments()
{
	if (app.documents.length < 1) throw "Expected at least one open document.";
	
	var portrait = null;
	var landscape = null;
	
	for (var i = 0, n = app.documents.length; i != n; ++i)
	{
		var lastChar = getLastCharOfName(app.documents[i]).toLowerCase();
	
		if (lastChar == "h" || lastChar == "l")
		{
			if (!landscape) landscape = app.documents[i];
		}
		else if (lastChar == "v" || lastChar == "p")
		{
			if (!portrait) portrait = app.documents[i];
		}
	}

	return [portrait, landscape];
}

function exportMiniFolio(f)
{
	var docs = getDocuments();
	
	if (!docs[0] && !docs[1]) throw "Failed to resolve either a landscape or a portrait document. You must specify at least one to export.";
	
	var folioMetadata = [
		[ "magazineTitle", "Cat Painter's Digest" ],
		[ "folioNumber", "1066" ],
		[ "description", "Our best folio ever!" ]
	];
	
	/* 
	 Note: the 4th parameter is a list of key/value pairs that can be used to set up parameters
	 
	 Available settings:
	 
	 assetformat: One of "png", "jpeg" or "auto" (default is png)
	 narrowdimensions: The narrow dimension for the output assets
	 widedimensions: The wide dimension for the output assets
	 jpegquality: If assetformat is jpeg, one of "max", "high", "med", "low" or "min"
	 tocimagefile: File to be used as this content stack's TOC image
	 fpoassetsdirectory: File to be used as root for relative paths in FPO resources
	 smoothscrolling: The smooth scrolling behavior for this stack (optional; default is 'no smooth scrolling')
	 spreads: If an integer, the page index to include. If a string, must be 'all' to include all pages (default is 'all')
	 contentstackid: If included, the explicit ID to be used for this stack. If omitted, ID is autogenerated
	 */
	app.exportMiniFolio(
		f, docs[0], docs[1], folioMetadata,
		[
			[ "widedimension", 1024 ],
			[ "narrowdimension", 768 ],
			[ "assetformat", "png" ],
			[ "tocimagefile",File("/c/temp/bundler/input/BundlerSDK_Folio/Adobe_Stack/tocPreview.png") ],
			[ "fpoassetdirectory",File("/c/temp/bundler/input/OverlayResources")],
             ["smoothscrolling", SmoothScrollingOptions.noSmoothScroll],
			[ "contentstackid", "SimpleExampleID" ]
		]
	);
}

try
{
	// Call simple utility function that resolves portrait and landscape documents by using a simple
	// naming convention, then packages the result as a mini-Folio
	exportMiniFolio(File("/c/temp/bundler/output/mini/Simple.folio"));
}
catch (e)
{
	alert("Oops: " + e);
}

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy