Goal
If you are ever in a situation where using Windows InDesign Server for creating documents with links to external images (linked artwork and not embedded) fails with Missing links error message, when the document is opened on Mac (and are not interested in installing InDesign extensions to fix link paths) ,this post is for you...
Solution
1) Use Windows InDesign Server 13.0 or higher
2) Run the script to create InDesign doc and link to external image. As the customer is using Windows InDesign server, it creates a windows specific path to image. When the document is opened on Mac, it fails with the obvious Missing Links error (path is windows specific).
3) To workaround this problem, the following script creates an InDesign document with link to external image using file:/// prefix and reinitLink() api.
eg. file:///Users/nalabotu/dev/temp/exists_in_mac_not_windows.jpeg
Make sure the path does NOT exist on InDesign server windows fs (say in C:\Users\nalabotu\dev\temp\exists_in_mac_not_windows.jpeg)
(function () { var TEST_FILE = "C:/dev/projects/files/test.indd", IMAGE_FILE = "C:/Users/nalabotu/Pictures/placeholder.jpg"; function addImageInPage(){ var doc = app.documents.add(), rectangle = doc.rectangles.add(); rectangle.geometricBounds = [10,10,30,30]; rectangle.frameFittingOptions.autoFit = true; try{ //add a placeholder image rectangle.place(IMAGE_FILE); }catch(err){ $.writeln(err); } var links = doc.links, PATH_EXISTS_IN_MAC_NOT_WINDOWS = "file:///Users/nalabotu/dev/temp/exists_in_mac_not_windows.jpeg"; for(var i = 0; i < links.length; i++ ){ var link = links[0]; try{ //link.relink(new File(PATH_EXISTS_IN_MAC_NOT_WINDOWS)); // relink to a file that exists on mac, but not windows where the doc was created link.reinitLink(PATH_EXISTS_IN_MAC_NOT_WINDOWS); }catch(err){ $.writeln(err); return; } } doc.save(new File(TEST_FILE)); doc.close(); } }());
4) The linked images exist on Mac
5) Open the created document on Mac, InDesign shows following alert. click Update Links
6) Fully resolved links in InDesign
No comments:
Post a Comment