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

Is it poissible to read andwrite data from a document without opening Indeisgn in .net framework(c#)

Community Beginner ,
Jul 27, 2020 Jul 27, 2020

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

TOPICS
SDK , Type

Views

1.4K

Translate

Translate

Report

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

correct answers 2 Correct answers

Community Expert , Jul 27, 2020 Jul 27, 2020

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

  • Work on IDML files instead of INDD file, these are in the simplest terms zipped packages of XML files that describe the whole InDesign document. You can open it and parse the XML to get all the information of the document without using InDesign at all. The format is
...

Votes

Translate

Translate
Explorer , Jul 13, 2023 Jul 13, 2023

Hi Manan,

 

Specially bullet 4 is helpful.

 

quote
  • you first create a ZIP file containing only the uncompressed mimetype file, then you append the remaining files.

 

Sumit

Votes

Translate

Translate
Community Expert ,
Jul 27, 2020 Jul 27, 2020

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

  • Work on IDML files instead of INDD file, these are in the simplest terms zipped packages of XML files that describe the whole InDesign document. You can open it and parse the XML to get all the information of the document without using InDesign at all. The format is open and you can study it at the following https://wwwimages.adobe.com/content/dam/acom/en/devnet/indesign/sdk/cs6/idml/idml-specification.pdf
  • Or if this is just about text content then you can export the text out using InDesign and then work on those text files, This will need use of InDesign to export text data before your .net application can work on it

-Manan

Votes

Translate

Translate

Report

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
Community Beginner ,
Jul 31, 2020 Jul 31, 2020

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

 

 

Votes

Translate

Translate

Report

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
Community Expert ,
Jul 31, 2020 Jul 31, 2020

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

Votes

Translate

Translate

Report

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
Community Beginner ,
Aug 03, 2020 Aug 03, 2020

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

Votes

Translate

Translate

Report

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
Community Expert ,
Aug 03, 2020 Aug 03, 2020

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

Votes

Translate

Translate

Report

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
Community Beginner ,
Aug 03, 2020 Aug 03, 2020

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

Votes

Translate

Translate

Report

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
Community Expert ,
Aug 03, 2020 Aug 03, 2020

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 )

Votes

Translate

Translate

Report

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
Community Beginner ,
Aug 03, 2020 Aug 03, 2020

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

Votes

Translate

Translate

Report

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
Community Expert ,
Aug 03, 2020 Aug 03, 2020

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:

  1. 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
    
  2. 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.

  3. 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
    
  4. 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

 

Votes

Translate

Translate

Report

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 ,
Jul 13, 2023 Jul 13, 2023

Copy link to clipboard

Copied

LATEST

Hi Manan,

 

Specially bullet 4 is helpful.

 

quote
  • you first create a ZIP file containing only the uncompressed mimetype file, then you append the remaining files.

 

Sumit

Votes

Translate

Translate

Report

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