{"id":8,"date":"2008-02-28T14:30:17","date_gmt":"2008-02-28T04:30:17","guid":{"rendered":"http:\/\/chuchuva.com\/pavel\/2008\/02\/how-to-automate-adobe-indesign-cs3\/"},"modified":"2009-12-10T14:29:16","modified_gmt":"2009-12-10T04:29:16","slug":"how-to-automate-adobe-indesign-cs3","status":"publish","type":"post","link":"https:\/\/chuchuva.com\/pavel\/2008\/02\/how-to-automate-adobe-indesign-cs3\/","title":{"rendered":"How to automate Adobe InDesign CS3"},"content":{"rendered":"<p>1. Locate Resources for Visual Basic.tlb in C:\\Documents and Settings\\All Users\\Application Data\\Adobe\\InDesign\\Version 5.0\\Scripting Support\\5.0 folder.<\/p>\n<p>2. Open command prompt and execute:<\/p>\n<pre><code>TlbImp.exe \"Resources for Visual Basic.tlb\" \/out:Interop.InDesign.dll<\/code><\/pre>\n<p>TlbImp.exe is located in C:\\Program Files\\Microsoft Visual Studio 8\\SDK\\v2.0\\Bin folder on my machine. This will generate Interop.InDesign.dll file. This is an interop assembly.<\/p>\n<p>3. Add reference to Interop.InDesign.dll to your project.<\/p>\n<p>4. Use this code:<\/p>\n<pre class=\"prettyprint\"><code>using System;\r\nusing InDesign;\r\n\r\nnamespace HelloInDesign\r\n{\r\n   class Program\r\n   {\r\n      static void Main(string[] args)\r\n      {\r\n         object missing = Type.Missing;\r\n         Type type = Type.GetTypeFromProgID(\"InDesign.Application.CS3\");\r\n         if (type == null)\r\n         {\r\n            throw new Exception(\"Adobe InDesign CS3 is not installed\");\r\n         }\r\n         _Application app = (_Application)Activator.CreateInstance(type);\r\n         Document document = (Document)app.Documents.Add(true, missing);\r\n         Page page = (Page)document.Pages[1];\r\n         TextFrame textFrame = page.TextFrames.Add(missing,\r\n            idLocationOptions.idUnknown, missing);\r\n         textFrame.GeometricBounds = new string[] { \"6p\", \"6p\", \"24p\", \"24p\" };\r\n         textFrame.Contents = \"Hello from .Net!\";\r\n      }\r\n   }\r\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1. Locate Resources for Visual Basic.tlb in C:\\Documents and Settings\\All Users\\Application Data\\Adobe\\InDesign\\Version 5.0\\Scripting Support\\5.0 folder. 2. Open command prompt and execute: TlbImp.exe &#8220;Resources for Visual Basic.tlb&#8221; \/out:Interop.InDesign.dll TlbImp.exe is located in C:\\Program Files\\Microsoft Visual Studio 8\\SDK\\v2.0\\Bin folder on my machine. This will generate Interop.InDesign.dll file. This is an interop assembly. 3. Add reference to Interop.InDesign.dll &hellip; <a href=\"https:\/\/chuchuva.com\/pavel\/2008\/02\/how-to-automate-adobe-indesign-cs3\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">How to automate Adobe InDesign CS3<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[8],"tags":[],"class_list":["post-8","post","type-post","status-publish","format-standard","hentry","category-develop"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/chuchuva.com\/pavel\/wp-json\/wp\/v2\/posts\/8","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chuchuva.com\/pavel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chuchuva.com\/pavel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chuchuva.com\/pavel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chuchuva.com\/pavel\/wp-json\/wp\/v2\/comments?post=8"}],"version-history":[{"count":0,"href":"https:\/\/chuchuva.com\/pavel\/wp-json\/wp\/v2\/posts\/8\/revisions"}],"wp:attachment":[{"href":"https:\/\/chuchuva.com\/pavel\/wp-json\/wp\/v2\/media?parent=8"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chuchuva.com\/pavel\/wp-json\/wp\/v2\/categories?post=8"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chuchuva.com\/pavel\/wp-json\/wp\/v2\/tags?post=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}