13 Replies Latest reply on Aug 11, 2017 12:12 AM by kavisaran

    How to modify the IDML file using JS?

    Praveen10 Level 1

      Hi All,

       

      Can anyone help me to figure-out the tool to modify the IDML file instead of unzip the IDML and editing in any word editors?

       

      Please confirm.

       

      Thanks,

       

      Praveen

        • 1. Re: How to modify the IDML file using JS?
          Mi_D Level 3

          u r working in xml base or doc....................

          • 2. Re: How to modify the IDML file using JS?
            Praveen10 Level 1

            In both the workflows.

            • 3. Re: How to modify the IDML file using JS?
              [Jongware] Most Valuable Participant

              Since this is the InDesign scripting forum, allow me to suggest this.

               

              You would run this hypothetical script from within InDesign, so why not simply "open" the IDML, make your adjustments, then export to IDML again? It's the perfect answer to your question.

              • 4. Re: How to modify the IDML file using JS?
                Praveen10 Level 1

                Hi Jongware,

                 

                Thanks for the response, I need to modify/update the IDML file without using InDesign application like suppose if I want to do some corrections in the texts part I need to directly update the IDML file and can generate the PDF file thro' automation. Hope I explained my requirement clearly now.

                 

                Thanks,

                 

                Praveen

                • 5. Re: How to modify the IDML file using JS?
                  Andreas Fink

                  I don´t know about solutions doing this in JavaScript but if you are willing to use Java take a look at http://idmllib.com

                  It is a Java library that fully encapsulates the IDML and offers easy tools to make modifications to the IDML.

                   

                  It is also possible to use Groovy with the IDMLlib to do a script like approach to work with IDML.

                   

                  Hope that helps.

                   

                  Best regards,

                   

                  Andreas

                  1 person found this helpful
                  • 6. Re: How to modify the IDML file using JS?
                    [Jongware] Most Valuable Participant

                    What you want is impossible.

                     

                    That is, apparently you want to create/modify an IDML document, and then create a PDF out of it, all without using InDesign.

                     

                    What you want is impossible. There is no relation at all between IDML and PDF -- in fact, IDML in itself is a totally useless format (without a matching version of InDesign). IDML, and all tools that manipulate IDML, describe and alter object relationships, but it cannot format text and paragraphs, or import images, or lay out tables, as InDesign does. IDML merely describes the objects, and InDesign is the actual executable that processes the data. Attempting to take InDesign out of the loop is ... naive to an extreme degree. It's comparable to asking how to drive a nail into a wall, not just without a hammer, but without any tool at all.

                     

                    It appears to me as if you have no clue at all to what IDML is, or what InDesign-the-program-itself does.

                     

                    Perhaps you should try to find someone using InDesign server and pay him a visit to see how that works.

                    • 7. Re: How to modify the IDML file using JS?
                      FrankB62 Level 1

                      @[Jongware],

                       

                      I think it is you who don't know what you are talking about. IDML is the format you use to transfer text between InDesign and other applications. You can create IDML-files in an external application and import them into InDesign, or you can save IDML-files from InDesign to be used in other applications. If you are purely working with InDesign, you would not need the IDML format at all.

                       

                      Two answer the question, I don't think there is any way of working directly within a ZIP-file. You will probably have to un-zip it, make your changes, and then zip it again.

                      • 8. Re: How to modify the IDML file using JS?
                        [Jongware] Most Valuable Participant

                        The OP stated

                         

                        I need to directly update the IDML file and can generate the PDF file thro' automation

                         

                        and I'll grant you it's possible to update an InDesign document by exporting it as IDML and edit that, but to get a PDF you still have to load the modified IDML into InDesign. Hence my suggestion to leave out the Export To IDML step and modify the ID document directly, from within InDesign.

                         

                        I must admit I didn't think the OP was not aware of the fact that "an" IDML file is in fact a zipped package. It's fairly common knowledge.

                         

                        Oh -- and it is possible to directly edit a file inside a ZIP. I'd even recommend it, because sometimes re-packaging an extracted IDML stores the files in another order than ID is expecting, and it simply won't open inside InDesign. http://indesignsecrets.com/batch-change-hyperlinks-across-a-whole-indesign-document.php mentions Seeker for Windows; http://indesignsecrets.com/drag-and-drop-applescripts-for-epub-idml-etc.php goes into detail for Mac OS X.

                        • 9. Re: How to modify the IDML file using JS?
                          FrankB62 Level 1

                          No, you don't have to load it into InDesign in order to make a PDF-file. IDML is a set of XML-files, and there are plenty of tools around to create PDF documents from XML-files. I have been doing that for more than 10 years. Try to look up XSL-FO.

                          • 10. Re: How to modify the IDML file using JS?
                            [Jongware] Most Valuable Participant

                            Oh dear lord.

                             

                            Yeah of course you are right; but then, why bother with IDML at all!? There is no XSLT to convert a set of InDesign IDML XML files into a PDF through XSL-FO, getting the same file as when exporting the file from within InDesign. Apart from the niceties of InDesign's own paragraph formatter (which are hard to copy), some functionality simply cannot be done with XSL-FO.

                             

                            Try to look up XSL-FO.

                             

                            It is funny because I looked at that .. wait, is it already more than 10 years ago? Oh yeah -- about 15 yrs.

                             

                            It's like you are saying, "InDesign imports Word and exports JPEG images -- but you don't need InDesign because you can export Word to plain text, then use ImageMagick to convert the plain text into a JPEG" -- and then expect the image to look like it came from InDesign.

                            • 11. Re: How to modify the IDML file using JS?
                              Praveen10 Level 1

                              Hi Frank/Jongware,

                               

                              ePub is also a ZIP format can be edited directly using some of the free tools like Sigil, etc. instead of unzipping -> editing -> zipping processes. I tried to edit the IDML file using this editor, but it's not accepting. This only came in mind that whether we can edit the IDML files by simply modifying the available tools or to create the new tools?

                               

                              Thanks,

                               

                              Praveen

                              • 12. Re: How to modify the IDML file using JS?
                                Mac_06 Level 2

                                If you don't want to unzipped----update----zip then you should look into Oxygen editor which understand the IDML and also validate it with schema.

                                Also I don't think there is any complete approach to modify IDML container with JS for this you should scratch Java or other language like VC++

                                 

                                Mac

                                • 13. Re: How to modify the IDML file using JS?
                                  kavisaran Level 1

                                  Hi Praveen,

                                   

                                  Could you got right answer for this, I am looking to edit IDML file through JS without unzip/zip.

                                   

                                  Like, we able to read/write docx without Winword / zip / unzip, the same logic i need it.

                                   

                                  Please if you have done it, please could you share to me.

                                   

                                  Thanks,

                                  Saravanan