Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Indesign (IDML file) Viewer using HTML5 and Javascript

New Here ,
May 29, 2014 May 29, 2014

I’m working on IDML file automation. My requirement is to showcase an IDML template in an HTML5 editor.

I have a simple TextFrame with Hello World text. I saved the file as: sample.idml. Then, I unzipped sample.idml and got a few files. Went to the stories folder and opened: story_d8.xml.

Since I’m a developer, I did this using Java and exposed the file path as a REST call. The biggest stopping point is: the jQuery/AngularJS script is saying:invalid file.

Can someone suggest options to address the points below:

  1. Get Content data using JavaScript (jQuery/AngularJS)
  2. Put "Demo Hello" in the Content and regenerate story_d8.xml (using JavaScript)
  3. Is this the correct approach? Are there alternative to this approach?

Note: My Requirement is to modifying IDML file at client side (javascript) only.

TOPICS
Scripting
2.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 29, 2014 May 29, 2014

Hi @

<!DOCTYPE html>

<html>

    <head>

        <meta charset="utf-8">

        <meta http-equiv="X-UA-Compatible" content="IE=edge">

        <title></title>

    </head>

    <body>

<pre class="result"></pre>

        <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>

        <script src="//cdn.jsdelivr.net/jquery.xml2json/1.2/jquery.xml2json.js" type="text/javascript" charset="utf-8" async defer></script>

<script type="text/javascript">

var mim;

$.ajax({

type: "POST",

url: "test.xml",

dataType: "xml",

success: function (data) {

        mim = $.xml2json(data);

        console.log(mim.Story.ParagraphStyleRange.CharacterStyleRange.Content);

}

});

</script>

    </body>

</html>

mim,

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 02, 2014 Jun 02, 2014

Dear mim_armand

I tried the same. By the way, i using xml file path from tomcat7 webserver. like "url: "http://localhost:8080/APP/idemlfp/test.xml"

I'm getting CORS issue. My server not allowing me to read file from path.

later, I tried "dataType:jsonp" , browser console shows JSON parse error but getting xml file structure. :=)

i don't to know who to hack this. Kindly help out in this.

you can reach me @ my skype id: "krishnaraoveera1294"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 02, 2014 Jun 02, 2014
LATEST

Of-course You can't send requests to your server from anywhere just like that, if you wanna enable CORS on your server I guess your best bet is to looks somewhere else (not in InDesign extendScript forums) like here!

Then if your server respond with XML to your requests (and you can't change it server-side) I don't know why you try json-p! you can't work around same-origin-policy like that on client-side! it's either jsonp (server-side) or CORS enabled, no other solution or hacks is possible!

I'll be happy to help if I can but I can't do it in your place my friend

Goodluck,

m,

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines