
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@imgly/idml-importer
Advanced tools
See the changelog for a detailed history of updates and improvements.
The InDesign Importer for the CE.SDK allows you to seamlessly integrate InDesign files into the editor while retaining essential design attributes.
Here's an overview of the main features:
The following InDesign design elements will be preserved by the import:
This InDesign Importer bridges the gap between InDesign files and CE.SDK scenes, enabling efficient transitions while retaining crucial design details. Your input is invaluable as we continue to refine and improve the importer's capabilities.
You can install @imgly/idml-importer via npm or yarn. Use the following commands to install the package:
npm install @imgly/idml-importer
yarn add @imgly/idml-importer
import CreativeEngine from "@cesdk/engine";
import { IDMLParser, addGfontsAssetLibrary } from "@imgly/idml-importer";
const blob = await fetch(
"https://img.ly/showcases/cesdk/cases/indesign-template-import/socialmedia.idml"
).then((res) => res.blob());
const engine = await CreativeEngine.init({
license: "YOUR_LICENSE",
});
// We use google fonts to replace well known fonts in the default font resolver.
await addGfontsAssetLibrary(engine);
const parser = await IDMLParser.fromFile(engine, blob, (content) =>
new DOMParser().parseFromString(content, "text/xml")
);
await parser.parse();
const image = await engine.block.export(
engine.block.findByType("//ly.img.ubq/page")[0],
"image/png"
);
const sceneExportUrl = window.URL.createObjectURL(image);
console.log("The imported IDML file looks like:", sceneExportUrl);
// You can now e.g export the scene as archive with engine.scene.saveToArchive()
By default, the IDML importer creates internal buffer:// URLs for embedded images. These are transient resources that work well when saving to an archive (engine.scene.saveToArchive()), which bundles all assets together.
However, if you want to save scenes as JSON strings (engine.scene.saveToString()) with stable, permanent URLs (e.g., for storing in a database or referencing CDN-hosted assets), you need to relocate the transient resources first.
saveToArchive): Include all assets in a single ZIP file. Transient buffer:// URLs work fine.saveToString): Only contain references to assets. Transient URLs won't work when reloading the scene later. You need permanent URLs (e.g., https://).After parsing the IDML file, use CE.SDK's native APIs to find and relocate all transient resources:
// 1. Parse the IDML file
const parser = await IDMLParser.fromFile(engine, blob, (content) =>
new DOMParser().parseFromString(content, "text/xml")
);
await parser.parse();
// 2. Find all transient resources (embedded images from the IDML)
const transientResources = engine.editor.findAllTransientResources();
// 3. Upload each resource and relocate to permanent URL
for (const resource of transientResources) {
const { URL: bufferUri, size } = resource;
// Extract binary data from the buffer
const data = engine.editor.getBufferData(bufferUri, 0, size);
// Upload to your backend/CDN (implement your own upload logic)
const permanentUrl = await uploadToBackend(data);
// Relocate the resource to the permanent URL
engine.editor.relocateResource(bufferUri, permanentUrl);
}
// 4. Now save to string - all URLs will be permanent
const sceneString = await engine.scene.saveToString();
When using addGfontsAssetLibrary() (the default font resolver), the resulting scene string will contain Google CDN URLs for fonts. If you need fonts hosted on your own infrastructure, configure a custom font resolver instead of using the default Google Fonts integration.
The default font resolver loads fonts from Google Fonts and substitutes common proprietary fonts (Helvetica, Arial, Times New Roman, etc.) with visually-similar Google Fonts equivalents. The font catalog and fallback aliases are served as two CE.SDK asset sources from the IMG.LY CDN:
| Asset source | Contents | Size (gzipped) |
|---|---|---|
ly.img.gfonts | 1,394 Google Fonts typefaces with all variants | ~127 KB |
ly.img.gfonts-fallbacks | 16 proprietary-font aliases (Helvetica→Roboto, Arial→Arimo, …) | ~3 KB |
addGfontsAssetLibrary(engine) registers both sources via engine.asset.addLocalAssetSourceFromJSONURI(...). The files are fetched from https://staticimgly.com/imgly/gfonts/<version>/dist/ at registration time and CE.SDK caches the font files once resolved.
No extra npm install is required. The sources are internal to IMG.LY and loaded from the CDN; you do not install an additional package.
If you want to resolve fonts from your own asset sources instead (for example, self-hosted fonts or an enterprise catalog), provide a custom fontResolver to the parser — the extension point is unchanged:
import { IDMLParser } from "@imgly/idml-importer";
const myResolver = async ({ family, weight, style }, engine) => {
// Return { typeface, font } from your own asset source, or null.
};
// The IDML parser accepts the resolver as its 4th argument.
const parser = await IDMLParser.fromFile(engine, blob, parseXml, myResolver);
You can also skip addGfontsAssetLibrary entirely and provide your own resolver if you do not want to depend on the IMG.LY-hosted catalog.
When using in NodeJS, you need to provide a DOM implementation. We recommend using JSDOM.
// index.mjs
// We currently only support ES Modules in NodeJS
import CreativeEngine from "@cesdk/node";
import { promises as fs } from "fs";
import { JSDOM } from "jsdom";
import { IDMLParser, addGfontsAssetLibrary } from "@imgly/idml-importer";
async function main() {
const engine = await CreativeEngine.init({
license: "YOUR_LICENSE",
});
// Register the IMG.LY-hosted Google Fonts asset sources used by the
// default font resolver. See "Font Loading" below for details.
await addGfontsAssetLibrary(engine);
const idmlSampleUrl =
"https://img.ly/showcases/cesdk/cases/indesign-template-import/socialmedia.idml";
const idmlSample = await fetch(idmlSampleUrl).then((res) => res.blob());
const idmlSampleBuffer = await idmlSample.arrayBuffer();
const parser = await IDMLParser.fromFile(
engine,
idmlSampleBuffer,
(content) => {
return new JSDOM(content, {
contentType: "text/xml",
storageQuota: 10000000,
url: "http://localhost",
}).window.document;
}
);
await parser.parse();
const image = await engine.block.export(
engine.block.findByType("//ly.img.ubq/page")[0],
"image/png"
);
const imageBuffer = await image.arrayBuffer();
await fs.writeFile("./example.png", Buffer.from(imageBuffer));
engine.dispose();
}
main();
If you encounter any issues or have questions, please don't hesitate to contact us at support@img.ly.
The IDML importer has some limitations and unsupported features that you should be aware of:
PDF Content
Linked Images
Text Frame Overflow
Font Support
Image Frame Fitting
The software is free for use under the AGPL License.
FAQs
Import IDML files into the Creative Editor Ecosystem
The npm package @imgly/idml-importer receives a total of 955 weekly downloads. As such, @imgly/idml-importer popularity was classified as not popular.
We found that @imgly/idml-importer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 13 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.