Returning values from InDesign Server scripts can be tricky. If you’re using the SOAP interface (I am, through .NET) and you need to get information back from the IDS script you’ve executed through
RunScript(), there's a bit of code reorganization to be done.
Let's say that you need to know the number of pages in your InDesign Document back in .NET land after the script has completed. This will not work:
var doc = app.open(File('test.indd'));
// do some stuff
The above script doesn't work because the
return doc.pages.length line isn't in the right spot (even though it seems like the last line of code to run in the script).
If you wrap all of the code in a function (let's say main) and move the call to
main() to the last line of the script then everything works as expected. IDS will return the number of pages in the document through SOAP to the initiating code in the
InDesignServer.Data.data object property.
The code below does work:
var doc = app.open(File('test.indd'));
doc = doStuff(doc);
// do some stuff
main(); // the return statement in this function actually gets returned
Here's a snippet of C# that would receive the return value from the IDS script (assumes that you've already connected to the webservice):
InDesignServer.Service idServer = new InDesignServer.Service();
InDesignServer.RunScriptParameters idParams = new InDesignServer.RunScriptParameters();
InDesignServer.Data data = new InDesignServer.Data();
String error = String.Empty;
Int32 numberOfPages = 0;
idParams.scriptFile = @"c:\path\to\script.jsx";
idServer.RunScript(idParams, out error, out data);
numberOfPages = Convert.ToInt32(data.data);
This reorganization of the script seems to work every time for me. I have consistently gotten proper results from IDS.
For some strange reason one of my InDesign Documents was using a plug-in from InDesign UI that was not available in InDesign Server.
You will receive this error from InDesign Server in the console:
Document.indd uses one or more plug-ins that are not currently available on your system. Cannot add this document to the book.
You will receive this error from ExtendScript when linked to InDesign Server (which is very common and thrown for a lot of other errors):
Result: ReferenceError: User canceled this action.
To fix this, the Preflight dialog under File will show you which plug-ins the current document is using (along with fonts, images, etc). Find the offending plug-in and re-save.
File » Preflight » External Plug-ins
I have a MacBook Pro with Boot Camp and both OS X and XP installed. I also have a copy of Creative Suite Design Standard CS3. The Adobe license allows users to install their software in two locations (a desktop and laptop, for instance) so that the primary user can maintain two computers. But what if you are using two operating systems?
May I use the software on more than one computer at a time?
The activation process supports installation on two machines. The Adobe product license agreement allows the primary user to install the product on a primary computer and also on a home or laptop computer for his or her use, provided that the two copies are not used simultaneously. While the activation process supports installing and activating Adobe software on two machines, the usage of the product on the second computer is restricted to the user who licensed the software. Allowing others to use a second copy of the software violates the product license agreement. (from Adobe.com)
I tried to use my license on an XP installation of CS3 Trial but alas, it did not work. I have a Mac version of the license and Windows isn’t pleased. A quick call to Adobe Customer Service yielded this response: “You can only install the second copy on an additional computer with the same operating system.”
Even though I am physically using the same computer for my two installations, I am out of luck. When you buy Adobe products, you’re only buying a license for one operating system. The customer service person I spoke with didn’t seem to really understand my dilemma (or even really care). I should have expected this but was blinded by the forward-thinking license.
I was having a horrendous time getting styles to apply to tags properly in InDesign while importing my content in through XML. My data would come in to the InDesign document just fine and then export to a PDF without any trouble – however the styles weren’t working properly. All of the text would grab the first style and intermittently switch to other styles.
Here’s the trick: when you use InDesign Server to merge XML into InDesign documents, you have to put a Paragraph Separator character between the XML tags… sometimes. You’ll be able to tell where you need it and where you don’t when you start importing data. I just included the \u2029 character in my XML files where it made a difference (style change).
I didn’t notice the character from InDesign exported XML at first because Altova XMLSpy and Visual Studio 2005 don’t show the paragraph separator. In fact, it appears to be a zero-footprint character (in my UTF-8 files). It saves in there and can exist in there but was generally impossible for me to see. (Maybe I have a local setting wrong?)
I’ve found a few ways to consistently crash InDesign Server. The easiest way is to send the webservice an INDD file that has links to images that don’t exist. I think it has to do with my templates being developed in OS X and then merged with XML in Windows. The Server console outputs an error message like this:
01/27/08 16:35:36 ERROR [link manager] Link missing.; Macintosh HD:Users:Eric:Desktop:InDesignGoodies:sudoku.png
The link manager freaks out at this point and crashes.
An unhandled win32 exception occurred in InDesignServer.exe .
Make sure you fix any broken links in your INDD files before using them in IDS!
Disclaimer: I am a programmer using InDesign. I am not a designer using InDesign.
If you try to Export XML from InDesign based on a document that you’ve created tags and a structure for then you may have encountered the this error dialog:
Content contains characters which cannot be encoded.
Well, that’s great… which characters? Where are they? As it turns out there are invisible characters in this InDesign document that help with spacing. I have no idea what they’re called (remember, I’m not a designer) but I can see what they do. Here’s a screenshot of the highlighted character:
That character pasted into Notepad resolves to this:
I’m sure InDesign has some really clever name for spacing character but I have no idea what name that is. Anyway, the trick to exporting XML from a tagged InDesign document is to make sure there are not any Adobe-specific (as far as I can tell) entities in the text.
Baseline Email is when you have a base of N unread messages in your inbox at any given time.
For me, it’s between 80-120 unread messages at any point. I never thought I’d become one of those people who can’t reply to the number of incoming emails quickly enough, but, I have. There is simply too much incoming mail to craft responses to every message that probably deserves a response.
To everyone who gets a reply a few weeks later, I apologize. Know that the response is heartfelt though, since it took a few moons.