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

Convert idml file into HTML

Contributor ,
Mar 17, 2023 Mar 17, 2023

Hello everyone,

Im currently working to convert the idml file into html and try to fix this via automation. And tried with some extendscript code

Main();

function Main() {
	// Check to see whether any InDesign documents are open.
	// If no documents are open, display an error message.
	if (app.documents.length > 0) {
		var myDoc = app.activeDocument;
		// Build the filename
		var myDocName = decodeURI(myDoc.fullName);
		var myDocBaseName = myDocName.substring(0, myDocName.lastIndexOf(".")); 
		// Export the page to FXL HTML
		with (myDoc.htmlFXLExportPreferences) {
			// HTMLRangeFormat = PageRangeFormat.EXPORT_ALL_PAGES
			HTMLRangeFormat = PageRangeFormat.EXPORT_PAGE_RANGE
			// HTMLPageRange = "1-2";
		}
		myDoc.exportFile(ExportFormat.HTMLFXL, new File(myDocBaseName + ".html"), true);
	}
	else {
		// No documents are open, so display an error message.
		alert("No InDesign documents are open. Please open a document and try again.")
	}
}

My requirement is to convert the idml file into HTML without formating and it has run in the background means which is helpful, some of the users haven't Indesign Application.
I have checked with different  languages ie., NodeJS, python, C# and not get any solution. Please anyone done this before share your idealogy and apporoach to proceed further.

Thanks


TOPICS
Scripting , SDK
2.2K
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
Community Expert ,
Mar 18, 2023 Mar 18, 2023

Hi Rocky@,

IDML is an open format so you need to read/understand the format specification and then do the translation to HTML as desired. Since IDML is just a bunch of XML files you could use any laguage like JS, Python etc to parse those XML files get the information relevant to you and then write the logic to use that information to create HTML files. It is a tedious process but not that complex.

-Manan

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
Contributor ,
Mar 19, 2023 Mar 19, 2023

Is it possible to convert with out Indesign application?

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
Community Expert ,
Mar 19, 2023 Mar 19, 2023

Yes absolutely, as I said IDML is a bunch of XML files. Read the specification so that you know where to look for which information, then parse the files, get the information you need and create HTML accordingly.

-Manan

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
Community Expert ,
Mar 19, 2023 Mar 19, 2023

Yes, by reading it as XML and converting, structure by structure, to HTML.

 

But ID could do it in five minutes. Open the IDML, export to HTML. Done. Can you find a workstation to use, or have a collaborator do this for you? It's like, five minutes and a small gift vs. uncounted hours of code translation.

 

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
Community Expert ,
Mar 20, 2023 Mar 20, 2023

Hi @James Gifford—NitroPress,

The charm behind this way of avoiding InDesign is to use other technolgies which might be needed to integrate into an already existing workflow, we also save license cost of InDesign. For ex. I once worked with a vendor who had their own solution to show creatives on the web, they then wanted to integrate the rendering of INDD files into that solution, for that they started with a IDML file, and that was parsed/converted into a JSON that their solution understood and then the reverse of edited JSON to IDML was done. All of this avoided InDesign installation and could be done in their existing tech stack of nodejs

-Manan

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
Community Expert ,
Mar 21, 2023 Mar 21, 2023

Many designers and shops have complex, unusual workflows that fit their needs, especially if they work from file formats outside the usual range.

 

But it can reach absurd heights when hours of work, complex conversions and proofing and manual changes are used simply to avoid, say, one tool. The above sounds like a shop that was well-stocked with JS coders and thought $20 a month for ID was an unnecessary charge. And who know, maybe that was the most effective workflow for them. But it sounds like a vast amount of work expended to avoid one minor hurdle... which is what I'm trying to caution the OP against. Unless there's some real need to go IDML -> HTML as a regular workflow, and the cost of ID or even having a third party do conversions for some nominal charge is a budget-breaker, I can't see how hours and hours of code conversion is an appropriate path.

 

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
Community Expert ,
Mar 23, 2023 Mar 23, 2023

Hi @James Gifford—NitroPress,

Let's leave the InDesign cost aside for a moment. Consider an automated workflow that might be doing lots of things and one of that task involves pulling data out of InDesign to be used in some other system. How do we deal with this requirement? Break the automatic flow of data through the pipeline, add in the manual conversion of INDD to IDML and then automate it further down the line. Remember this is an unskilled job and now the whole workflow is dependent on a manual process to handle this conversion so it ceases to be an automated process anymore. We should also remember, we can't automate this conversion via scripts as InDesign desktop license would not permit it in an automated fashion and bringing in IDS which serves these needs would be an overkill. So we lose all the benefits acrrued from the automated system created thus far only because a piece(InDesign) had to be accomodated manually. In such cases organisations seek solutions that don't require InDesign at all. In many instances I have found that folks/organisations dealing with these workflows had not idea/experience with InDesign and did not want to deal with it as it was not the main portion of the system anyhow. So it's not just a matter of InDesign cost but other factors as well. This has been my exprience with these kind of solutions.

-Manan

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
Community Expert ,
Mar 23, 2023 Mar 23, 2023

Overall, I would agree completely, and I missed that this seems to be an ongoing need for the OP, not a one-time effort.

 

I'll just counter that this all revolves around what is indisputably and solely an InDesign file format. The question is not how to convert one universal or generic format to another (say, XML to HTML, or RTF to HTML, or the like), and somehow shoehorn ID into the loop, but how to convert a file that can pretty much only exist if exported from ID... which can open those files and re-export to HTML about as fast as a user can click the buttons, and do a very clean, controllable job of it.

 

Maybe there's a very specific need for an external process to convert IDML to HTML, without access or cost of InDesign. But I'm having trouble imagining a situation where the vast amount of work to develop a script or conversion process that is good enough to rely on, and then dealing with what will surely be a need for manual cleanup on most converted files, outweighs simply using the tool at the heart of it to do the job. If $20 a month is too much to keep ID around, a contractor could surely be found to do batch conversions for some modest fee.

 

I completely concede that the OP or their employer may need exactly this process for their own reasons. But from well over twenty years of doing platform to platform conversion projects, I can't quite imagine the situation that makes brief, occasional use of ID to do the task the lesser option. 🙂

 

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
Contributor ,
Mar 27, 2023 Mar 27, 2023

in5 plugin supports for Indesign Server 2020 and above?

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 ,
Feb 20, 2025 Feb 20, 2025

There is indeed a script to convert IDML file to HTML / text. You can do it with a python script that I developed. It uses SimpleIDML library and aims at extracting text content in correct order, while also creating a list of images assiciated with your IDML file. Please, refer to github repo: idml2html-python  .

 

The script is intended for batch processing and goes with a bash script that first looks for IDML files and extracts them, and creates list of files that is fed to the py script.

 

There is also an online javascript app which convert IDML into html / text.  It is here: https://textvisualization.app/idml2html/ You can use it to view text content of an IDML file if you do not have inDesign. Surely, you can use it as a converter and extractor of text and image links.  

 

meme.jpegexpand image

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 ,
Feb 20, 2025 Feb 20, 2025
LATEST

The script to convert IDML to HTML / text is here: https://github.com/roverbird/idml2html-python

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