npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@imgly/eps-importer

v0.1.0

Published

Import EPS artwork as native CE.SDK groups.

Readme

@imgly/eps-importer

Import EPS artwork into an existing CE.SDK scene as one group of native blocks. The group can be moved, scaled, saved with the scene, and exported through CE.SDK. Requires CE.SDK 1.82 or later and Node.js 22 or later for server use.

Install

npm install @imgly/[email protected] @imgly/[email protected]

Use @cesdk/cesdk-js or @cesdk/engine in the browser, and @cesdk/node for headless Node.js applications. The compatible PDF importer is installed as a dependency. Browser applications must host the conversion runtime assets as described below; Node.js resolves them from the installed package.

Place artwork

Create or load a scene first, then pass EPS bytes, an ArrayBuffer, or a browser File/Blob:

import { placeEPS } from '@imgly/eps-importer';
import { createConversionRuntime } from '@imgly/pdf-conversion-utils';

const runtime = createConversionRuntime({
  assetBaseURL: new URL('pdf-conversion/', document.baseURI)
});

const result = await placeEPS(engine, file, {
  runtime,
  parent: page,
  frame: { x: 20, y: 30, width: 200, height: 150 },
  signal: abortController.signal
});

console.log(result.group, result.diagnostics);
// When the application has finished all work using this runtime:
runtime.dispose();

The frame uses the scene's design unit and coordinates relative to the parent. Placement scales the source bounding box proportionally to fit inside the frame and centers it on both axes, preserving whitespace in the EPS. Native paths outside the source box do not change that fit. The source bounding box is returned separately in PostScript points (1/72 inch).

Creating the importer or runtime does not load Ghostscript. The first valid EPS import starts the conversion worker. Applications that expect frequent EPS use can call runtime.preload() after the editor is usable. Reuse the same runtime for repeated EPS imports to share its loaded assets. A runtime passed through options is borrowed: only its owner should dispose it. Without an explicit runtime, imports use a shared default instance.

For browser deployments, copy worker.browser.js, gs.js, and gs.wasm from @imgly/pdf-conversion-utils to the configured asset directory. Consult that package's browser asset and CSP documentation. Keep these files from the same build together with COPYING.AGPL-3.0, LICENSE.md, PROVENANCE.md and THIRD_PARTY_NOTICES.md from its dist/ directory. These documents include the full AGPL text, third-party notices and matching Ghostscript build sources and runtime wrapper sources.

Replace an artwork placeholder

import { replaceEPS } from '@imgly/eps-importer';

const result = await replaceEPS(engine, file, {
  runtime,
  target: artworkPlaceholder,
  signal: abortController.signal
});

The target must be an unrounded rectangular graphic with a solid color fill, absolute layout, and no effects, blur, stroke, drop shadow, crop, flipping, animations, or children. In, out, and loop animations are rejected both before conversion and before replacement. Replacement captures this explicit target before conversion starts; changing the editor selection does not redirect the result. A changed or deleted target is rejected. Image-fill replacement and arbitrary masks are outside the supported contract.

Replacement retains the parent, stacking position, rotation, visibility, export inclusion, opacity, name, kind, metadata, placeholder setting, transform lock, scopes, time offset, and duration. All imported artwork remains active for the placeholder's full duration, including inside a timed parent group. The imported group is centered inside the target's original frame using proportional contain. A successful placement or replacement creates one undoable operation. User edits made during asynchronous conversion remain separately undoable. Changing the target's timing or export inclusion during conversion rejects replacement and preserves that edit. Failure, cancellation, or a scene change preserves unrelated content.

Import without placement

import { EPSImporter } from '@imgly/eps-importer';

const importer = new EPSImporter(engine, { runtime });
const result = await importer.loadAsGroup(epsBytes, {
  signal: abortController.signal
});
engine.block.appendChild(page, result.group);

loadAsGroup() returns a PreparedEPS with a detached group and does not create an undo step.

Attach the group to keep it, or call result.dispose() to discard it before adding it to undo history. The idempotent callback destroys the imported blocks and releases their unused image buffers, font buffers, and spot-color definitions. Resources used by other blocks remain available. Calling engine.block.destroy(result.group) alone does not release these resources.

Once the artwork enters undo history, keep its resources available for undo/redo and do not call dispose().

The group contains a non-selectable transparent bounds anchor so whitespace from the EPS bounding box survives movement, scaling, and scene serialization. Keep that anchor with the artwork.

Node.js and headless use

The APIs also accept an engine initialized through @cesdk/node. Construct the runtime with createConversionRuntime(); Node resolves its assets from the installed package and runs conversion in worker_threads. Browser-headless use accepts an @cesdk/engine instance without the editor UI. Neither environment requires selection state or an asset-source integration.

To retain CMYK ink values when exporting the imported artwork, enable CMYK PDF output explicitly:

const pdf = await engine.block.export(page, {
  mimeType: 'application/pdf',
  exportPdfWithDeviceCMYK: true
});

The default PDF export uses RGB. The headless example in examples/import-eps.mjs enables CMYK output. This option preserves supported CMYK content; it does not recover color information already converted during import, or establish PDF/X compliance.

The importer does not require the separate engine/Skia fix for fractional PDF page sizes. It retains the EPS source dimensions in the scene. Existing CE.SDK PDF exporters can round fractional page dimensions during export, so the exported page may differ slightly from the imported frame. The general PDF-export fix was merged separately in engine #17256 and Skia #15. Older engine versions can still import, edit, and save the artwork; adopting the export fix is not an EPS importer requirement.

Supported content and diagnostics

The importer accepts single-page EPS with a PostScript EPSF header and a finite, positive bounding box. DOS-EPS previews, HiResBoundingBox, nonzero/negative origins, and trailer-declared (atend) bounds are supported. Missing bounds, ordinary PostScript, multiple output pages, malformed input, and failed conversions produce errors. A nonempty partial PDF from a failed Ghostscript run is never treated as success.

Ghostscript converts EPS to an internal PDF, then the PDF importer emits native CE.SDK text, graphics, and image blocks. There is no raster fallback for the whole artwork. The PDF intermediate is an implementation detail. Resolved fonts, including standard PostScript fonts, are embedded to preserve their glyphs and spacing through PDF import. Embedded images remain images; fonts without embeddable or available outlines can be substituted by Ghostscript and are reported through diagnostics. The PDF import stage uses exact-fidelity text handling without requesting Google Fonts. Outlined artwork gives the most predictable results.

Device CMYK, including K-only black and knockout white, is retained where represented by the imported PDF. Named spot colors use the scene's registry. If an existing name has a different definition, the importer keeps the existing definition and reports a warning; rename or reconcile conflicting inks before import when the source definition must be retained. CMYK values, browser preview appearance, and final PDF/X compliance are separate concerns. A normal CE.SDK PDF export is not a PDF/X validation. Validate the actual template, fonts, output intent, and exported PDF with the intended print workflow.

Axial and radial shading can be imported as a native gradient with sampled RGB stops. Mesh shading retains its decoded triangle geometry as an editable vector with a solid average RGB fill; SHADING_MESH_FLATTENED reports the lost corner-color gradient. The SHADING_COLORSPACE_CONVERTED diagnostic reports when the PDF stage loses the source gradient's color-space information. A visually similar gradient therefore does not establish CMYK separation fidelity. Embedded images also use CE.SDK's image sampling, which can differ from the source renderer for very low-resolution artwork.

Successful results include diagnostics from conversion and PDF import. Inspect their stage, severity, message, and optional code. EPSImportError carries a code and diagnostics when available. Aborting can also reject with the signal's abort reason. Cancellation terminates active Ghostscript work; a subsequent import can retry with the same runtime.

Default limits are 20 MiB input, 100 MiB converted PDF, 14,400-point coordinates/dimensions, 30 seconds per conversion, and 10,000 engine allocations during PDF import. Override them through limits. Output and block limits are checked at their respective stages; they do not cap peak WASM memory or PDF parsing time.