Copy link to clipboard
Copied
Hi Expert
I want to create a document and want to write on it.
I want to read data from an existing document.
I want to do all of these stuffs in .NET framework using C# without opeing the InDeisgn.
Everytime, I am reading data from an InDeisgn document it is opening the instance of the InDeisgn.
I do not want that.
Here is my little code :
Type oType = Type.GetTypeFromProgID(sProgID);
if (oType != null)
{
InDesign.Application app = Activator.CreateInstance(oType);
}
InDesign.Document doc = app.ActiveDocument;
InDesign.Page page = (InDesign.Page)doc.Pages[1];
InDesign.TextFrame frame = (InDesign.TextFrame)page.TextFrames[1];
Console.WriteLine(frame.Contents.ToString());
How can I manage this "Activator.CreateInstance(oType)"?
Thanks
Avijit
Hi Avijit,
Indd is a proprietary file format that can only be read by the InDesign application. So reading it without the applications help would be a very big reverse engineering task, Now you have the following option to do this
Hi Manan,
Specially bullet 4 is helpful.
you first create a ZIP file containing only the uncompressed mimetype file, then you append the remaining files.
Sumit
Copy link to clipboard
Copied
Hi Avijit,
Indd is a proprietary file format that can only be read by the InDesign application. So reading it without the applications help would be a very big reverse engineering task, Now you have the following option to do this
-Manan
Copy link to clipboard
Copied
Hi Manan
Thanks for the pdf. It is very much helpful.
But, I am unable to save or export IDML file as ZIP file. I need the xml files.
I have used two processes to do that :
One is : File -> Save As (“InDesign CS4 or later (IDML)”)
Another one is : File -> Export
Copy link to clipboard
Copied
It is an archive file format. There are lots of libraries out there which can unpackage and package it. For the simplest way just open it with an zip utility as you do with a zip file and it will show its contents to you
-Manan
Copy link to clipboard
Copied
Hi Manan
I am unable to see packages inside an IDML file. Do I need to install any IDML tools for that?
Thanks
Avijit
Copy link to clipboard
Copied
How did you unpackage/unzip it? What do you get on unzipping it? Its simple, tools like 7zip on Win, Unarchiver on MAC can unzip the IDML file to see its contents.
-Manan
Copy link to clipboard
Copied
Hi Manan
Thanks a lot Manan. Extraction completed. How can convert those files to IDML again after doing some modifications?
Thanks
Avijit
Copy link to clipboard
Copied
Hi piks,
I can open any IDML file with e.g. 7zip on my Windows 10 machine.
With ExtendScript scripting InDesign you can do:
app.unpackageUCF( idmlFile , destinationFolder );
There are no "packages" inside an idml file. The idml file itself is the "package".
It contains xml files and xml files in folders plus one mimetype file.
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Hi Laubender
I am also able to view the xml files by using 7zip. How can I convert those files to IDML again after doing some modifications on some files (for example : Story_ue4.xml file inside Stories).
Thanks
Avijit
Copy link to clipboard
Copied
The IDML archive file is in Adobe UCF format, you can read about it in the IDML specification. I am quoting some relevant portions of the document below.
In addition to being a ZIP file, a UCF file follows several rules described here. The rules for building the archive are as follows:
A file called mimetype must be the first file in the archive, and it must be stored uncompressed. It must
contain the following line:
application/vnd.adobe.indesign-idml-package
The META-INF directory can contain several files expected by UCF. IDML uses two such files, container.xml describes the file type and points to the root file (desinmap.xml), and metadata.xml contains XMP metadata.
The hierarchy of files as described in the IDML Language Specification must exist at the top level of the archive. (A common mistake is to compress the files into a subdirectory.) For example:
mimetype
META-INF/container.xml
META-INF/metadata.xml
designmap.xml
MasterSpreads/MasterSpread_A.xml
Resources/Fonts.xml
Resources/Graphic.xml
Resources/Preferences.xml
Resources/Styles.xml
Spreads/Spread_spread1.xml
Spreads/Spread_spread2.xml
Stories/Story_story0.xml
Stories/Story_story1.xml
XML/BackingStory.xml
XML/Mapping.xml
XML/Tags.xml
Build the ZIP file with UNIX path component separators (/), even on Windows. With Java, it is possible to build ZIP files with \ separators on Windows; however, InDesign cannot use such files. The fact that these files exist in a package presents an initial implementation hurdle. The first steps in working with IDML involve examining a package and deciding how to deal with the archive files.
Several options are available for building packages:
IDMLTools contains Java code that demonstrates compressing and decompressing packages using Java’s built-in ZIP support. See the com.adobe.idml.Package class for an example of how packages are handled in the Java samples. For your convenience, a command-line version of the class can be driven using the package-wrapper scripts. Setup and use of these tools is described in the IDML ReadMe file.
InDesign provides scripting support for creating a package from the files on the file system.
ActionScript 3.0/Air can compress and decompress packages. For an example, see the
CompressionUtils.as class in any ActionScript sample.
You can use off-the-shelf, ZIP-compliant software like WinZip. WinZip has been shown to be compatible with InDesign; however, it is more difficult to control the order and compression of individual files in the archive. To work around this, you first create a ZIP file containing only the uncompressed mimetype file, then you append the remaining files.
-Manan
Copy link to clipboard
Copied
Hi Manan,
Specially bullet 4 is helpful.
you first create a ZIP file containing only the uncompressed mimetype file, then you append the remaining files.
Sumit