Created
April 29, 2017 16:36
-
-
Save pboethig/8f0e35023b7993853d309469384ca096 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| InDesignServer.Objects allGraphics = this.document.AllGraphics;//your indd document | |
| this.basePath = "C:/myimages/"; | |
| foreach (dynamic graphic in allGraphics) | |
| { | |
| InDesignServer.Link link = graphic.ItemLink; | |
| string path = link.FilePath; | |
| string fileName = this.basePath + "/" + link.Name; | |
| object fileSystemObject = Microsoft.VisualBasic.Interaction.CreateObject("Scripting.FileSystemObject", ""); | |
| Type fileSystemObjectType = Type.GetTypeFromProgID("Scripting.FileSystemObject"); | |
| object file = fileSystemObjectType.InvokeMember("GetFile", System.Reflection.BindingFlags.InvokeMethod, null, fileSystemObject, new object[] { path }); | |
| link.Relink(file); | |
| link.Update(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment