1

I have an IDML file that I unzipped. I now want to compress the expanded folder back into an IDML file. I have access to a Mac or Linux machine.

What are the ways I can do this?

Zipping the file using zip (command line) or with Keka, BetterZip or Archive Utility don't work. InDesign issues the error:

Cannot open the file. Adobe InDesign may not support the file format, a plug-in that supports the file format may be missing, or the file may be open in another application.

Jongware
  • 22,200
  • 8
  • 54
  • 100
Eli
  • 85
  • 1
  • 8
  • Just zip it. `zip mynewversion.idml file1 file2 ...` or `zip -r` for the whole directory. – doog abides Apr 21 '15 at 02:15
  • Unfortunately this does not work. Here's the message I get. `Cannot open the file. Adobe InDesign may not support the file format, a plug-in that supports the file format may be missing, or the file may be open in another application.` – Eli Apr 21 '15 at 03:40
  • Are you compressing the folder itself, or the contents? I get that error when I compress the folder (using 7-Zip), but it works just fine as long as I make sure to compress the contents. – Christina Apr 21 '15 at 13:58
  • 1
    Asked and answered elsewhere: http://indesignsecrets.com/topic/how-do-i-re-zipcompress-an-expanded-idml-file – Jongware Apr 22 '15 at 17:30

2 Answers2

4

The problem with regular zip is that the zip archive contains a “mimetype” file that shouldn’t be compressed if you want InDesign to identify the newly-created IDML. So the way you have to re-zip the file (and the way the ePub scripts work) is like this:

  1. They first create a zip archive which contains only the mimetype file, uncompressed. zip -X0 'myfile.idml' mimetype

  2. Then they add the rest of the files/folders into the zip archive, this time with full compression. zip -rDX9 "myfile.idml" * -x "*.DS_Store" -x mimetype


In shell script terms, the ePub scripts do this (assuming the current directory is the one containing all the IDML contents):

zip -X0 'myfile.idml' mimetype # create the zip archive 'myfile.idml', containing only the 'mimetype' file with no compression

zip -rDX9 "myfile.idml" * -x "*.DS_Store" -x mimetype # add everything else to the ‘myfile.idml’ archive, EXCEPT .DS_Store files and the ‘mimetype’ file (which is already there from the previous step)


To save you time reading the zip man page, here’s what all these options mean:

-X = “no extra” — do not save extra file attributes like user/group ID for each file

-0 = “compression level zero” — no compression

-r = “recurse paths” — go through everything in the directory, including nested subfolders

-D = “no directory entries” — don’t put special stuff in the zip archive for directories

-9 = “compression level 9 (optimal)”

-x = “exclude these files”

Follow this voodoo, and you should be able to create legal IDML files.

Source: http://indesignsecrets.com/topic/how-do-i-re-zipcompress-an-expanded-idml-file

A big thanks to Chuck Weger and David Blatner at http://indesignsecrets.com

Eli
  • 85
  • 1
  • 8
0

From within InDesign

  1. use this jsx script to expand an IDML
//DESCRIPTION: Expands an IDML file into folder format
ExpandIDML();
function ExpandIDML(){
    var fromIDMLFile = File.openDialog("Please Select The IDML File to unpackage");
    if(!fromIDMLFile){return}
    var fullName = fromIDMLFile.fullName;
    fullName = fullName.replace(/\.idml/,"");
    var toFolder = new Folder(fullName);
    app.unpackageUCF(fromIDMLFile,toFolder);
}
  1. And that one to produce an IDML package:
//DESCRIPTION:Produces an IDML package from the contents of a directory:
CreateIDML();
function CreateIDML(){
    var fromFolder = Folder.selectDialog("Please Select The Folder to package as IDML");
    if(!fromFolder){return}
    var fullName = fromFolder.fullName;
    // var name = fromFolder.name;
    // var path = fromFolder.path;
    var toIDMLFile = new File(fullName+".idml");
    app.packageUCF(fromFolder,toIDMLFile);
}
léo
  • 1
  • 1