{"id":179,"date":"2012-09-28T13:08:28","date_gmt":"2012-09-28T04:08:28","guid":{"rendered":"http:\/\/www.terrainvague.info\/quotes\/?p=179"},"modified":"2012-09-28T13:08:28","modified_gmt":"2012-09-28T04:08:28","slug":"illustrator_text_swap_jpg_export_from_csv_by_jsp","status":"publish","type":"post","link":"https:\/\/www.terrainvague.info\/quotes\/?p=179","title":{"rendered":"illustrator text swap &#038; jpg export from CSV by JSP"},"content":{"rendered":"<p>\u9700\u8981\u304c\u3042\u308b\u304b\u3069\u3046\u304b\u306f\u77e5\u308a\u307e\u305b\u3093\u304c\u3001CSV\u306e\u30c6\u30ad\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u30a4\u30e9\u30ec\u306b\u4e00\u884c\u305a\u3064\u3044\u308c\u3066JPG\u306b\u66f8\u304d\u51fa\u3059.JS\u3002<br \/>\n<a href=\"http:\/\/d.hatena.ne.jp\/tittea\/20080330\/1206879032\">\u3053\u3053<\/a>\u3068\u304b\u3092\u53c2\u8003\u306b\u3055\u305b\u3066\u9802\u304d\u307e\u3057\u305f\u3002\u3042\u308a\u304c\u305f\u3057\u3002<br \/>\n<a href=\"http:\/\/d.hatena.ne.jp\/tittea\/20080330\/1206879032\">http:\/\/d.hatena.ne.jp\/tittea\/20080330\/1206879032<\/a><\/p>\n<blockquote><p>\nparseCSVandReplace();<br \/>\nfunction parseCSVandReplace() {<br \/>\n\/\/Open CSV file (last line = blank)<br \/>\nfileObj = new File(&#8220;\/FILEPATH\/list.csv&#8221;);<br \/>\nflag = fileObj.open (&#8220;r&#8221;,&#8221;&#8221;,&#8221;&#8221;);<br \/>\nif (flag){<br \/>\nvar txt = fileObj.read();<br \/>\n}<br \/>\n\/\/split csv data by newline<br \/>\nvar line = txt.split(&#8216;\\n&#8217;);<br \/>\n\/\/repeat below until the number reaches to the last line<br \/>\nfor(var ss = 0;ss<line.length-1;ss++){\n\/\/csv line -> tmp (ss = line number)<br \/>\nvar tmp = line[ss];<br \/>\n\/\/Replace illustrator text[top layer] with csv data(tmp)<br \/>\nactiveDocument.textFrames[0].contents = tmp ;<br \/>\n\/\/save as jpeg<br \/>\njpegOpt = new ExportOptionsJPEG();<br \/>\njpegOpt.qualitySetting = 100;<br \/>\nfilename = &#8220;\/FILEPATH\/&#8221;+ss+&#8221;.jpg&#8221;;<br \/>\nsaveFile = new File(filename);<br \/>\nactiveDocument.exportFile(saveFile, ExportType.JPEG, jpegOpt);<br \/>\n}<br \/>\nreturn ;<br \/>\n}\n<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u9700\u8981\u304c\u3042\u308b\u304b\u3069\u3046\u304b\u306f\u77e5\u308a\u307e\u305b\u3093\u304c\u3001CSV\u306e\u30c6\u30ad\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u30a4\u30e9\u30ec\u306b\u4e00\u884c\u305a\u3064\u3044\u308c\u3066JPG\u306b\u66f8\u304d\u51fa\u3059.JS\u3002 \u3053\u3053\u3068\u304b\u3092\u53c2\u8003\u306b\u3055\u305b\u3066\u9802\u304d\u307e\u3057\u305f\u3002\u3042\u308a\u304c\u305f\u3057\u3002 http:\/\/d.hatena.ne.jp\/tittea\/2008 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/www.terrainvague.info\/quotes\/index.php?rest_route=\/wp\/v2\/posts\/179"}],"collection":[{"href":"https:\/\/www.terrainvague.info\/quotes\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.terrainvague.info\/quotes\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.terrainvague.info\/quotes\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.terrainvague.info\/quotes\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=179"}],"version-history":[{"count":0,"href":"https:\/\/www.terrainvague.info\/quotes\/index.php?rest_route=\/wp\/v2\/posts\/179\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.terrainvague.info\/quotes\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.terrainvague.info\/quotes\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=179"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.terrainvague.info\/quotes\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}