Posts tagged "Adobe CQ"

AEM Assets workflow for automatic PDF generation from InDesign files

Many of my Enterprise customers ask how they can use Adobe Experience Manager (AEM) to automate the production of common derivative files from their InDesign files. Derivative files, you ask? InDesign files often represent the “source of truth” for many business documents, from manuals to data sheets to publications and many more types. These documents must be transformed from InDesign into something else (hence the term derivative) in order to be made available on a web site, for instance. The usual method is to export a PDF from InDesign and then upload the PDF as a new asset into the repository. This puts added burden on the author of the InDesign file as well as introducing the possibility of error due to incorrectly set PDF job options. This gets even more complicated if the author must make versions suitable to send to a commercial printer as well as a version that’s optimized for reading online as a PDF. This article provides techniques to automate the production of a web-optimized and print-optimized PDF from any InDesign file that appears in AEM Assets.

This article assumes that you have access to Adobe Experience Manager Assets and InDesign Server. In this example, I use AEM 6.1 and InDesign CC Server 2015, but the technique should work with AEM 5.6.1 and higher and ID Server CS6 and higher. You need to ensure that you have configured your AEM Author environment to work with InDesign server according to the documentation found here. The foundation of any successful integration (beyond configuration!) is the combination of Scripts, Workflow Models, and Workflow Launchers.

You can download a package that contains the scripts and a workflow model you can use today. When you install the package, you will have new scripts located at /etc/dam/indesign/scripts and /etc/workflow/scripts. You will also see a new Workflow Model located at /etc/workflow/models/dam/. The Workflow Launcher must be reconfigured, since I didn’t want to disrupt your existing workflows after you install the package.


Scripts tell AEM or external applications what to do, and they form the basis of any InDesign Server-based solution. There are two sets of scripts used here: one set for InDesign Server to generate the PDFs and the other for AEM to move the resulting files. First, let’s look at the JavaScript to tell InDesign Server what we want it to do and how we want it to respond to the request.

There are a number of InDesign Server scripts included in the basic AEM installation, and I’ve modified /etc/dam/indesign/scripts/PDFExport.jsx to request specific kinds of PDF from InDesign Server.  In addition, the script writes the new PDF files into the InDesign file’s /renditions node. These two scripts are located at /etc/dam/indesign/scripts/PDFExport_Print.jsx and at /etc/dam/indesign/scripts/PDFExport_Web.jsx. I could have easily combined these two operations into one script, but I wanted to leave you the option to easily enable or disable each one according to your requirements. You can also combine them yourself or make them fancier, responding to properties you set on the InDesign file in AEM (via XMP) and read out with InDesign Server. Here is the code for PDFExport_Web.jsx, which is almost identical to PDFExport_Print.jsx. The difference is in the value of pdfExportPreset in line 31, the filename set in line 56, and the function return value set in line 57.

// Export any Indesign document as PDF

//==== get soap arguments ====
if (app.scriptArgs.isDefined("credentials")) {
 var credentials = app.scriptArgs.getValue("credentials");
} else {
 throw "CQ host credentials argument is missing";
if (app.scriptArgs.isDefined("cqHost")) { 
 var host = app.scriptArgs.getValue("cqHost");
} else {
 throw "cqHost argument is missing";
if (app.scriptArgs.isDefined("resource")) { 
 var resourcePath = app.scriptArgs.getValue("resource");
} else {
 throw "resource argument is missing";

try {
 //==== create a temporary folder under InDesign server tmp directory to fetch and export ====
 // added randomness to the folder name
 var exportFolder = new Folder("tmp-" + (new Date().getTime() - Math.floor((Math.random()*10000)+1) ));
 fileName = resourcePath.substring (resourcePath.lastIndexOf ('/'), resourcePath.lastIndexOf ('.'));
 var sourceFile = new File(exportFolder.fullName + fileName + '.indd');
 var outputFile = new File(exportFolder.fullName + fileName + '_web.pdf');
 var pdfExportPreset = "[Web Preset]" // Set your PDF Web-ready Export Preset (joboption) here.
 // You can use any joboption file installed in InDesign Server

 app.consoleout('Fetching resource from CQ: '+resourcePath);
 fetchResource (host, credentials, resourcePath, sourceFile);

 var document =;

 with (app.pdfExportPreferences) {
 viewDocumentAfterExport = false;
 var myPDFExportPreset = app.pdfExportPresets.item(pdfExportPreset);
 document.exportFile(ExportFormat.pdfType, outputFile,myPDFExportPreset);

 // close the document
 //==== remove the original resource and send the export back to CQ ====

 //==== send file to CQ ====
 var target = resourcePath.substring (0, resourcePath.lastIndexOf ('/')) + "/renditions";
 app.consoleout('Posting this file to CQ: '+outputFile);
 app.consoleout('Posting to location: ' + target);
 putResource (host, credentials, outputFile, fileName + '_web.pdf', 'application/pdf', target);
 returnValue = "PDF for Web exported and posted successfully";
} finally {
 //==== remove the temp folder ====
app.consoleout('Finished PDF for Web export using '+pdfExportPreset+' joboptions');

To use these scripts, you need to have a PDF Joboptions file installed in InDesign Server to export your PDF. When you install the package, you will find a new folder at /content/dam/InDesign Server joboptions that contains two PDF Export Presets for InDesign Server. Move these two files to Applications/Adobe InDesign CC Server 2015/Resources/Adobe PDF/settings/mul and then restart InDesign Server to load the new settings.

Now that we have the InDesign Server pieces in place, let’s look at the AEM script. This is an ECMA script, which is very much like JavaScript, and it’s located at /etc/workflow/scripts/move-pdf-renditions.ecma. I’ve written it as a function that’s called twice, once for each PDF rendition, so it’s easy to add or remove other renditions as you see fit. This script will be called from the Workflow Model, which we’ll look at next. Here’s the script code.

var renditionExtension = "pdf";
var mimeType = "application/pdf";

var workflowData = graniteWorkItem.getWorkflowData();


function movePDF (renditionPostfix) {
 if (workflowData.getPayloadType() == "JCR_PATH") {
 var path = workflowData.getPayload().toString();
 var resourceResolver = graniteWorkflowSession.adaptTo(;
 var resource = resourceResolver.getResource(path);
 if (resource !== null) {
 var asset =;
 if (asset !== null) {
 var name =, ".");
 var renditionName = name + "_" + renditionPostfix + "." + renditionExtension;
 var rendition = asset.getRendition(renditionName);
 if (rendition !== null) {
 var renditionResource = resourceResolver.getResource(rendition.path);
 var stream = renditionResource.adaptTo(;
 var targetPath = asset.adaptTo( + "/" + renditionName;
 var assetManager = resourceResolver.adaptTo(;
 assetManager.createAsset(targetPath, stream, mimeType, true);
 } else {
 log.debug("rendition " + renditionName + " cannot be found on asset " + path);
 } else {
 log.debug("Item is not an asset: " + path);
 } else {
 log.debug("Item does not exist: " + path);

Workflow Model

There will be a new Workflow Model in your Workflows list called DAM Update Asset with PDF move located at /etc/workflow/models/dam/update_asset_pdf/. It is similar to and derived from the standard DAM Update Asset workflow that comes with every AEM installation. I have changed one existing step (Media Extraction) and added a new step (a Process step called “Move PDFs from Renditions”).

These two workflow steps are different from the standard DAM Update Assets workflow

These two workflow steps are different from the standard DAM Update Assets workflow

The Media Extraction step is designed to convert InDesign documents to other formats required by AEM Assets for a number of key functionalities. These include generating sub-assets (images that are embedded within the InDesign file), page images, extraction of text, and metadata synchronization, among other things. Media Extraction sends the script (and a pointer to the InDesign file) as its payload to InDesign Server. InDesign Server then runs the script and returns something to AEM. It is important that you do not remove any of the existing scripts that Media Extraction launches, but you can always add additional steps. Here, we added two additional scripts to the workflow step: PDFExport_Print.jsx and PDFExport_Web.jsx

The Print and Web PDF Export scripts have been added to the Media Extraction Workflow Step.

The Print and Web PDF Export scripts have been added to the Media Extraction Workflow Step.

Immediately after Media Extraction, I added a new Process step that executes an ECMA script in AEM. For many users, they will access AEM Assets via their desktop using the AEM Assets Companion tool or the Creative Cloud Desktop tool, so this workflow ensures that they get the renditions they need in a place that’s easy to find. Also, users of AEM Assets will be able to search for these PDFs like any other asset under management. This script copies the PDFs from /renditions as new assets adjacent to the InDesign file. It is best to leave the PDFs in /renditions so that they can be used by components that might offer the PDF as a download, for instance.


The new Process step executes an ECMA script that copies the new PDF files so that they are accessible on the desktop.

Workflow Launcher

Lastly, it is necessary to change the Workflow Launcher that is triggered whenever a file appears in the repository or whenever a file is modified in the repository. I did not include this change in the package so that you can install the package with no impact on your running system. When you are ready and have tuned the scripts for your workflow, then you can enable the Workflow in the Workflow Launcher panel.

In your AEM Author instance, click on Tools>Workflow>Launchers or visit http://localhost:4502/libs/cq/workflow/admin/console/content/launchers.html (of course, point at your Author instance!). Select the /content/dam(/.*/)renditions/original that has no condition on it (see screenshot below) and click on View Properties, and then on Edit.

Select the proper Launcher and view its properties

Select the proper Launcher and view its properties

The Launcher is designed to run a workflow when a specific condition is met. This workflow looks for any file that appears in the repository and then runs the DAM Update Asset workflow on it. You need to change the workflow to DAM Update Asset with PDF Move and then Save the changes.

Change the workflow that is triggered by the Launcher

Change the workflow that is triggered by the Launcher

Once you’ve saved the Launcher, you are ready to test. Upload an InDesign document into AEM using your preferred method. You can use drag and drop in a Browser window, AEM Assets Companion, or CC Desktop Tool. If you happen to catch the InDesign Server console, you will see new entries that report on whether IDS was successful at exporting PDF renditions. In a short while, your new PDF  files will magically appear next to the InDesign file. Now, go ahead an edit that InDesign file and save it back to AEM Assets. Again, the workflow will run and new PDF files will replace the existing ones, ensuring that you always have access to the latest versions. And, since they are assets under management, you can always revert to earlier versions of the PDF by looking at the asset timeline in a browser.


This new workflow and the scripts that support it expose a new behavior for AEM Assets. While convenient for the user, since it automatically generates useful and necessary derivatives of the source InDesign asset, it enforces known good business processes by encapsulating approved PDF Export settings into he workflow. It also reduces errors by automating a task that otherwise would require several configuration steps in InDesign before they could export the PDF.

I hope that you find this useful, and that you use it as a starting point for further InDesign Server automation using AEM Assets.

Share on Facebook

Fixing Adobe Drive after Yosemite upgrade

Like many Mac users, I upgraded my Mavericks machine to Yosemite. While the upgrade should be smooth for most things, Adobe Drive requires an update due to changes in the way that Yosemite manages file systems. Since Drive provides low-level file system services and the hooks to those services changed, the old installation needs to be removed and reinstalled in order for Drive to work properly.

The process is simple. Browse to the Adobe Drive Installation Page and download two things: Adobe Drive and the AdobeDrive5UninstallUtility.dmg. Mount the AdobeDrive5UninstallUtility.dmg, and then follow these steps:

  1. Open Terminal
  2. Type “sudo ” (include the space after sudo)
  3. From the mounted AdobeDrive5UninstallUtility.dmg volume, drag to Terminal so that your command in Terminal looks something like:
    sudo /Volumes/AdobeDrive5-UninstallUtility/AdobeDrive5-UninstallUtility/
  4. Hit enter
  5. Enter your computer’s admin password
  6. You should now see something like the following in the Terminal:
    OSX 10.10.3 release made changes to a few systems calls.
    Manually altering Adobe Drive's Installer Hooks to be compatible with new release...
    Done with file replacements!
  7. Quit Terminal

You can now mount AdobeDrive5_0_3-mul.dmg and install Adobe Drive successfully.

Customers who use Adobe Drive with Adobe Experience Manager may also need to install a package to ensure compatibility with Drive 5.0.3. Specifically, if you are using Drive with AEM 5.6.1, AEM 6.0, AEM 6.0 SP1, AEM 6.0 SP2 then you need to install a patch on your AEM server. The patch is delivered as an AEM Package, and you can install it on your Author instances as necessary. If you use AEM 6.1 or higher, then you do not need to install this package.

One last thing: if you will be using Adobe Bridge CC in the workflow (and who doesn’t?), ensure that you keep Adobe Bridge CC up to date to avoid unexpected crashing issues. If you are in a managed deployment environment, then contact your system administrator to ensure that you have the latest Adobe Bridge CC installed.

Share on Facebook

Come learn how to use AEM for DPS Libraries and Entitlement at Adobe Summit

I’ll be leading a lab at Adobe Summit this year that helps to tighten the integration between Adobe Digital Publishing Suite (DPS) and Adobe Experience Manager (AEM). AEM has had the ability to manage and publish content to DPS for a couple of years now, and customers are having great success using AEM as a templated design surface on which to make DPS folios.

Customers who want to leverage DPS Entitlement have had to build or buy a solution that usually but not always runs on a Apache with PHP/MySQL. The Adobe DPS Developer portal has several examples, including a great starter kit. Customers have been asking, though, how to use the user management built in to AEM to manage entitlement.

In addition, DPS apps often have custom Libraries and Storefronts, which are basically HTML portals that interact with the DPS app and the DPS Services to provide a customized experience in the app. Customers also will build or buy custom Library/Storefront solutions based on the DPS Library APIs.

My lab at Summit, presented with my good friend Herman Lee of Ensemble Systems, shows how to use AEM to both manage DPS entitlement and to create and manage custom Library/Storefront code. AEM is an excellent design surface for this, with its flexible component architecture and its ability to integrate with Enterprise Identity management solutions. The session is “L709 – Implement an Adobe Digital Publishing Suite storefront in Experience Manager” and it takes place on Tuesday Afternoon at 1:30 to 3:30 Utah time. If you’re going to Summit, sign up today for my lab and learn how to get even more value out of your AEM and DPS investments. You’ll need to login to the Summit site in order to register.

Share on Facebook

Using InDesign CS6 Server with CQ5.5

Many of my customers have learned that CQ5.5 DAM can be used in conjunction with InDesign Server to extract content from InDesign documents and make them available for use in web pages in CQ. This worked great with CQ5.5 and InDesign CS5.5 Server, but failed with InDesign CS6 Server. I have an easy fix that enables InDesign content extraction for CQ5.5 and InDesign CS6 Server workflows.

First, start up your CQ Author environment and log in. Open CRXDE and search for spaceUnit. It will show up in one of the InDesign scripts.

If you don’t want to search, here’s the link to the jsp.


Direct path here: /etc/dam/indesign/scripts/XHTMLExport.jsx

Right under spaceUnit is another variable called marginUnit. Comment out those two lines of code from the script, and you should be all set.

Apparently spaceUnit and marginUnit were supported in CS5.5 and earlier, but not in CS6.

Also, Adobe Drive 4 is required for DAM integration with CS6 applications. If CS5.5 is in play, then you will need Adobe Drive 3. As of August, 2012, the download link is halfway down the right hand column of the Adobe Drive Product Page. Drive 3 and Drive 4 can coexist if you need to have CS5/5.5 and CS5

Share on Facebook

Using Adobe CQ5 as a repository for Acrobat Shared Reviews

Acrobat has a great feature called Shared Reviews, which allows an Acrobat Pro user to send a PDF to one or more people for their comments while allowing each of the reviewers to see all of the comments that had been made by all of the other reviewers. While the default method in Acrobat 9 and X is to use as the repository, it is possible to use another server, such as Adobe CQ5, as the repository.

In a shared review, Acrobat needs two things: a PDF that has been prepared to receive comments and share them with other reviewers, and a network location that all of the reviewers can access for storing the comments. In a Shared Review, the comments are stored in a comment repository that is disconnected from the PDF itself. Acrobat uses this methodology so that it can always check with the repository to determine whether there are new comments that have been added to the PDF while you were away from it. It is very important that the repository be in a network location that is accessible to everyone, and that means using a WebDAV server. Why WebDAV? WebDAV shares use a path that looks the same on all operating systems, which is not the case for a SMB, AFP, or other operating system specific file system protocols. In addition, it is not necessary to mount the remote volume in order to communicate with it, since WebDAV has a number of file system access features that can be used through standard web calls. Acrobat knows this, so it does not need to mount the repository in order to use it for shared reviews.

To begin, we need to create a folder in CQ5 that will act as the repository for reviews. It is important that this repository be somewhat obfuscated to the casual user, so it is good to put it inside of a universal access folder that sits inside of an admin access folder. For instance, if I made a top level folder in the DAM called acrobat_reviews and inside of that another folder called repository, I would set the permissions on acrobat_reviews so that only the administrators can see it, and I would set the permissions on the repository folder so that everyone can read and write. You can also create a folder elsewhere in the repository that’s not in /var/dam. This is handy because it prevents Adobe Drive users from seeing the repository at all when they mount CQ DAM through Adobe Drive. Of course, you will want to consult your CQ system administrator to ensure that your repository location and permissions abide by your corporate policies.

Create a new folder in CRXDE LiteLet’s create a folder outside of CQ DAM and use it as our repository for Acrobat shared reviews. You will need a CQ5 Author instance to which you have administrative access and Acrobat X or a version of Acrobat that supports shared reviews. First, open up CRXDE Lite. You can create a folder other ways, but using CRXDE Lite is quick and only requires a web browser.

Navigate to the root of your CQ system, right-click on the root, and choose Create>Create Folder.

Name that folder acrobat_reviews. Right click on “acrobat_reviews” and choose Create>Create Folder again, and then name this new folder “repository”. The path bar should now show /acrobat_reviews/repository.

You’re not done yet, though, because the changes to the repository haven’t been written. You must click the “Save All” button to save the repository changes.

Now, let’s set permissions for the folders. Recall that we want to forbid access to the acrobat_reviews folder but allow access to the repository folder. In this example, we will use the user known as anonymous. You might want to use your LDAP or Active Directory groups to govern access, for instance, assuming that you have connected your LDAP or Active Directory system to your CQ instance. To set permissions, we need to use the CQ User Manager, otherwise known as CQ Security. Return to your CQ author instance landing page and click the User Manger. Double click the Anonymous user and click the Permissions tab.

Click the plus sign to the left of acrobat_reviews to show its subfolders. Leave the permissions on the acrobat reviews alone, and set the permissions on the repository to Read, Modify, Create and Delete as shown.

Click the Save link above the Path column heading to save the permission changes.

Now, we’re ready to use CQ as a repository for our Acrobat X Shared reviews.

In Acrobat X, open a PDF you want to send for Shared Review and click the Comment button to open the Comment Pane. Click the Send for Shared Review button, and then choose “Automatically collect comments on my own internal server” and click Next.

Choose the Web Server folder option. Enter the full URL to your repository. In my example, my repository is operating on my laptop and is running on port 4502. The URL to the repository is therefore http://localhost:4502/acrobat_reviews/repository. You will need to know your server URL and active port to the author instance in order to enter your own information, though. Click Next and Acrobat will prompt you for your credentials to access the repository. I used the Anonymous user, so I enter anonymous (lower case “a”) for the user and leave the password blank. If you click Save this Information, then the userid and password will be saved in Acrobat’s keychain. Each user who accesses the review will have to enter their own credentials. For groups, therefore, it makes sense to use groups to control access to the folder and therefore provide at least userid and password access to the reviews. Acrobat will create and delete a test file on the server, after which it will prompt you to choose how to send the review notification to reviewers.

You can choose to send the file with your default email application or send it later. If you are on a Mac, Acrobat looks for Microsoft Entourage, so if you aren’t using Entourage, then you might have trouble sending email from Acrobat on your Mac. In that case, save the file to attach to email later. On Windows, Acrobat supports more email clients. In any case, test to ensure that Acrobat supports your email client. If you decide to allow Acrobat to create the email, there are two options. You can choose to send the PDF as an attachment or as a link in the email message. Pick one, click Next, and then enter a name for your Server Profile. This will allow you to reuse these settings when you start Shared Reviews later.

Once you send the file to someone for review, they will need to be able to access the server, so be sure that the server URL is accessible to all of the reviewers. When a reviewer opens the PDF, they will login to the server, add comments, and then post them to the repository for other reviewers to see.

Because of its built-in WebDAV and easy to configure security, CQ5 is a great technology for Shared Review and Forms Data Collection workflows.

Share on Facebook