A complete photobook editor with a layouts library, photo auto-fill, live design validation, and export to print-ready PDF/X-4.

Pre-requisites#
This guide assumes basic familiarity with Next.js and TypeScript.
- Node.js v22+ with npm – Download
- Supported browsers – Chrome 114+, Edge 114+, Firefox 115+, Safari 15.6+
See Browser Support for the full list
Get Started#
Start fresh with a standalone Photobook Editor project. This creates a complete, ready-to-run React application built with Vite, with a start screen, an editor, and an export pipeline. To add the editor to your Next.js project, use the Existing Project tab.
Step 1: Create a New Project#
npx create-next-app@latest your-project-name --typescript
cd your-project-namenpx create-next-app@latest your-project-name --typescript
cd your-project-namepnpm create next-app@latest your-project-name --typescript
cd your-project-namepnpm create next-app@latest your-project-name --typescript
cd your-project-nameyarn create next-app@latest your-project-name --typescript
cd your-project-nameyarn create next-app@latest your-project-name --typescript
cd your-project-nameStep 2: Copy the Editor Logic#
Copy the kit’s editor logic into the project you just created:
npx degit imgly/starterkit-photobook-editor-react-web/src/client/src/imgly ./imglynpx degit imgly/starterkit-photobook-editor-react-web/src/client/src/imgly ./imglygit clone https://github.com/imgly/starterkit-photobook-editor-react-web.git
cp -r starterkit-photobook-editor-react-web/src/client/src/imgly ./imgly
rm -rf starterkit-photobook-editor-react-webgit clone https://github.com/imgly/starterkit-photobook-editor-react-web.git
cp -r starterkit-photobook-editor-react-web/src/client/src/imgly ./imgly
rm -rf starterkit-photobook-editor-react-webRemove the Vite Environment Variable#
The starter kit is built with Vite. demo-assets.ts reads import.meta.env, which Next.js does not provide, so the build fails. Delete this line:
const configured: string = import.meta.env.VITE_DEMO_ASSETS_BASE_URL ??The kit then loads its demo assets from the IMG.LY CDN URL on the next line. To serve them from your own server, replace that URL.
Step 3: Install Dependencies#
Install the required packages for the editor:
Core Editor#
Install the Creative Editor SDK:
npm install @cesdk/cesdk-js@1.87.0-rc.3 @cesdk/engine@1.87.0-rc.3npm install @cesdk/cesdk-js@1.87.0-rc.3 @cesdk/engine@1.87.0-rc.3pnpm add @cesdk/cesdk-js@1.87.0-rc.3 @cesdk/engine@1.87.0-rc.3pnpm add @cesdk/cesdk-js@1.87.0-rc.3 @cesdk/engine@1.87.0-rc.3yarn add @cesdk/cesdk-js@1.87.0-rc.3 @cesdk/engine@1.87.0-rc.3yarn add @cesdk/cesdk-js@1.87.0-rc.3 @cesdk/engine@1.87.0-rc.3Print Ready PDF#
Add the PDF/X conversion used by the export:
npm install @imgly/plugin-print-ready-pdfs-web@1.87.0-rc.3npm install @imgly/plugin-print-ready-pdfs-web@1.87.0-rc.3pnpm add @imgly/plugin-print-ready-pdfs-web@1.87.0-rc.3pnpm add @imgly/plugin-print-ready-pdfs-web@1.87.0-rc.3yarn add @imgly/plugin-print-ready-pdfs-web@1.87.0-rc.3yarn add @imgly/plugin-print-ready-pdfs-web@1.87.0-rc.3Step 4: Download Assets#
CE.SDK requires engine assets (fonts, icons, UI elements) to function. These must be served as static files from your project’s public/ directory.
curl -O https://cdn.img.ly/packages/imgly/cesdk-js/1.87.0-rc.3/imgly-assets.zip
unzip imgly-assets.zip -d public/
rm imgly-assets.zipcurl -O https://cdn.img.ly/packages/imgly/cesdk-js/1.87.0-rc.3/imgly-assets.zip
unzip imgly-assets.zip -d public/
rm imgly-assets.zipStep 5: Create the Editor Component#
Create the editor and hand it to initPhotobookEditor with the scene to open:
'use client';
import CreativeEditor from '@cesdk/cesdk-js/react';
import { initPhotobookEditor } from '../imgly';
export default function PhotobookEditor() { return ( <CreativeEditor config={{ userId: 'your-user-id', baseURL: '/assets' }} init={(cesdk) => initPhotobookEditor( cesdk, 'https://your-server.example.com/photobook-assets/style-playful-portrait.imgly', { width: 220, height: 286 } ) } width="100vw" height="100vh" /> );}initPhotobookEditor takes the editor, the scene URL, and the page size in millimeters. It configures the editor and loads the scene. Pages added later get that size. The page format and the asset root come from the scene.
Filling the book with photos is your app’s job, not the kit’s. See Set Up a Scene for the calls that do it.
Step 6: Use the Component#
Mount the editor in your app. CE.SDK needs browser APIs, so load the component with server rendering turned off:
'use client';
import dynamic from 'next/dynamic';
const PhotobookEditor = dynamic(() => import('./PhotobookEditor'), { ssr: false});
export default function Page() { return <PhotobookEditor />;}Get Started#
Add the photobook editor to a web application that already uses CE.SDK. You take the editor logic, install the packages it needs, point it at your asset host, and decide whether you want an export server.
Step 1: Copy the Editor Logic#
cd your-projectcd your-projectClone the starter kit and copy the editor logic into your project:
git clone https://github.com/imgly/starterkit-photobook-editor-react-web.git
cp -r starterkit-photobook-editor-react-web/src/client/src/imgly ./imgly
rm -rf starterkit-photobook-editor-react-webgit clone https://github.com/imgly/starterkit-photobook-editor-react-web.git
cp -r starterkit-photobook-editor-react-web/src/client/src/imgly ./imgly
rm -rf starterkit-photobook-editor-react-webnpx degit imgly/starterkit-photobook-editor-react-web/src/client/src/imgly ./imglynpx degit imgly/starterkit-photobook-editor-react-web/src/client/src/imgly ./imglyRemove the Vite Environment Variable#
The starter kit is built with Vite. demo-assets.ts reads import.meta.env, which Next.js does not provide, so the build fails. Delete this line:
const configured: string = import.meta.env.VITE_DEMO_ASSETS_BASE_URL ??The kit then loads its demo assets from the IMG.LY CDN URL on the next line. To serve them from your own server, replace that URL.
The imgly/ folder holds the layouts library, the auto-fill, the validation checks, and the editor configuration, with no dependency on the demo application:
imgly/├── index.ts # Editor initialization function├── photobook.ts # Sizes, styles, and the scene each starts from├── photos.ts # Upload asset source for the reader's photos├── autofill.ts # Places photos and captions into placeholders├── placeholders.ts # What counts as unfilled placeholder content├── photo-stash.ts # Holds photos that a smaller layout cannot fit├── editor.ts # Applies the editor configuration and its assets├── spreads.ts # The book as spreads of pages├── add-spread.ts # Adds a spread at the end of the book├── preview-mode.ts # Switches to the preview and back├── preview-label.ts # Names the spread under the preview├── spread-export.ts # One print-file page per spread├── block-utils.ts # Engine helpers shared across the kit├── constants.ts # Shared identifiers and panel helpers├── plugins/layouts/│ └── layout.ts # Layouts asset source and layout switching├── validation.ts # The print validation checks├── validation-types.ts # Validation result types├── validation-utils.ts # Validation helpers├── asset-middleware.ts # Turns a photo click into a drag hint├── demo-assets.ts # Demo asset URLs└── config/ ├── design-editor/ # The editor configuration │ ├── plugin.ts # Main configuration plugin │ ├── actions.ts # Export/import actions │ ├── features.ts # Feature toggles │ ├── i18n.ts # Translations │ ├── settings.ts # Engine settings │ ├── keyboard/ # Keyboard shortcut catalog │ └── ui/ # UI customization └── preview/ # The preview configurationValidation runs on its own: the checks in imgly/validation.ts report every problem they find without further setup. The user-facing names and descriptions for those reports are presentation, and the kit keeps them in src/client/src/app/validation-config.ts. That file is not required for validation to run — copy it if you want its wording, or write your own labels in your UI.
Step 2: Install Dependencies#
Install the required packages for the editor:
Core Editor#
Install the Creative Editor SDK:
npm install @cesdk/cesdk-js@1.87.0-rc.3 @cesdk/engine@1.87.0-rc.3npm install @cesdk/cesdk-js@1.87.0-rc.3 @cesdk/engine@1.87.0-rc.3pnpm add @cesdk/cesdk-js@1.87.0-rc.3 @cesdk/engine@1.87.0-rc.3pnpm add @cesdk/cesdk-js@1.87.0-rc.3 @cesdk/engine@1.87.0-rc.3yarn add @cesdk/cesdk-js@1.87.0-rc.3 @cesdk/engine@1.87.0-rc.3yarn add @cesdk/cesdk-js@1.87.0-rc.3 @cesdk/engine@1.87.0-rc.3Print Ready PDF#
Add the PDF/X conversion used by the export pipeline:
npm install @imgly/plugin-print-ready-pdfs-web@1.87.0-rc.3npm install @imgly/plugin-print-ready-pdfs-web@1.87.0-rc.3pnpm add @imgly/plugin-print-ready-pdfs-web@1.87.0-rc.3pnpm add @imgly/plugin-print-ready-pdfs-web@1.87.0-rc.3yarn add @imgly/plugin-print-ready-pdfs-web@1.87.0-rc.3yarn add @imgly/plugin-print-ready-pdfs-web@1.87.0-rc.3This plugin runs in the browser. See Print Ready PDF for its options.
Step 3: Download Assets#
CE.SDK requires engine assets (fonts, icons, UI elements) to function. These must be served as static files from your project’s public/ directory.
curl -O https://cdn.img.ly/packages/imgly/cesdk-js/1.87.0-rc.3/imgly-assets.zip
unzip imgly-assets.zip -d public/
rm imgly-assets.zipcurl -O https://cdn.img.ly/packages/imgly/cesdk-js/1.87.0-rc.3/imgly-assets.zip
unzip imgly-assets.zip -d public/
rm imgly-assets.zipThe kit’s layout and style scenes are a separate bundle. Host it yourself and serve the scene from that same root: the kit derives the asset root from the scene URL you pass.
Step 4: Create the Editor Component#
Create the editor and hand it to initPhotobookEditor with the scene to open:
'use client';
import CreativeEditor from '@cesdk/cesdk-js/react';
import { initPhotobookEditor } from '../imgly';
export default function PhotobookEditor() { return ( <CreativeEditor config={{ userId: 'your-user-id', baseURL: '/assets' }} init={(cesdk) => initPhotobookEditor( cesdk, 'https://your-server.example.com/photobook-assets/style-playful-portrait.imgly', { width: 220, height: 286 } ) } width="100vw" height="100vh" /> );}initPhotobookEditor takes the editor, the scene URL, and the page size in millimeters. It configures the editor and loads the scene. Pages added later get that size. The page format and the asset root come from the scene.
Filling the book with photos is your app’s job, not the kit’s. See Set Up a Scene for the calls that do it.
Step 5 (Optional): Offload Rendering to a Node Server#
Keep browser-side export and you are done — nothing else is required.
Rendering a long book on a low-powered device is the case for moving the work off the reader’s machine. Copy the bundled server. It is five files:
src/server/index.ts # Composition root: wires the exporter in, listens on 8080, graceful shutdownsrc/server/http/routes.ts # The five routes, size and rate limits, job wiring, JSON error handlersrc/server/imgly/export.ts # Renders the scene archive with @cesdk/nodesrc/server/jobs/store.ts # In-memory job store, limits, and the expiry sweepsrc/shared/export-api.ts # Wire types shared with the clientCopy the server into your project:
git clone --depth 1 --branch release-1.87.0-rc.3 https://github.com/imgly/starterkit-photobook-editor-react-web.git
mkdir -p src
cp -r starterkit-photobook-editor-react-web/src/server starterkit-photobook-editor-react-web/src/shared ./src/
rm -rf starterkit-photobook-editor-react-webgit clone --depth 1 --branch release-1.87.0-rc.3 https://github.com/imgly/starterkit-photobook-editor-react-web.git
mkdir -p src
cp -r starterkit-photobook-editor-react-web/src/server starterkit-photobook-editor-react-web/src/shared ./src/
rm -rf starterkit-photobook-editor-react-webThe server imports one function from imgly/. Point the import at your copy:
import { removeBlanksForPrint } from '../../client/src/imgly/spread-export.ts';import { removeBlanksForPrint } from '../../../imgly/spread-export.ts';The server asks @cesdk/node for its native engine (engine: 'native'), because a large book runs out of memory on the WASM engine. The native engine runs on Linux x64 with glibc 2.39 or newer, macOS on ARM or x64, and Windows x64. Check that against your base image before you build.
Install what the server needs:
npm install @cesdk/node@1.87.0-rc.3 express dotenvnpm install @cesdk/node@1.87.0-rc.3 express dotenvpnpm add @cesdk/node@1.87.0-rc.3 express dotenvpnpm add @cesdk/node@1.87.0-rc.3 express dotenvyarn add @cesdk/node@1.87.0-rc.3 express dotenvyarn add @cesdk/node@1.87.0-rc.3 express dotenvAdd the tools that run and type-check it:
npm install --save-dev tsx @types/express @types/nodenpm install --save-dev tsx @types/express @types/nodepnpm add --save-dev tsx @types/express @types/nodepnpm add --save-dev tsx @types/express @types/nodeyarn add --dev tsx @types/express @types/nodeyarn add --dev tsx @types/express @types/nodeThe server is Node code and has its own tsconfig.json, so exclude src/server from the TypeScript configuration of your app.
Start the server. It listens on port 8080. Set CESDK_LICENSE in .env, otherwise the PDF has a watermark.
npx tsx src/server/index.tsnpx tsx src/server/index.tsTo render on a backend you already run instead, implement the same contract. Match the wire types in src/shared/export-api.ts and these routes:
| Route | Purpose |
|---|---|
POST /api/export |
Upload the scene archive, receive a job id |
GET /api/export/:id |
Poll the job status |
GET /api/export/:id/file |
Download the rendered PDF |
DELETE /api/export/:id |
Discard a job the client no longer needs |
GET /api/health |
Readiness probe |
The client calls these as relative paths, so serve them on the same origin or proxy them.
Route Exports Through the Server#
The kit’s export.ts calls these routes, shows the progress dialog, and handles cancel, timeouts, and a busy server. It imports print-ready-pdf.ts, so finish Exporting Print-Ready PDFs first. Then copy it and the file it imports:
git clone --depth 1 --branch release-1.87.0-rc.3 https://github.com/imgly/starterkit-photobook-editor-react-web.git
cp starterkit-photobook-editor-react-web/src/client/src/app/export.ts starterkit-photobook-editor-react-web/src/client/src/app/export-browser.ts ./photobook-export/
rm -rf starterkit-photobook-editor-react-webgit clone --depth 1 --branch release-1.87.0-rc.3 https://github.com/imgly/starterkit-photobook-editor-react-web.git
cp starterkit-photobook-editor-react-web/src/client/src/app/export.ts starterkit-photobook-editor-react-web/src/client/src/app/export-browser.ts ./photobook-export/
rm -rf starterkit-photobook-editor-react-webThe wire types are in src/shared/, so update this import:
import type { ExportJobStatusResponse } from '../../../shared/export-api';import type { ExportJobStatusResponse } from '../src/shared/export-api';export.ts reads a Vite variable, which your project does not provide. Replace this line:
const USE_SERVER = import.meta.env.VITE_USE_SERVER === 'true';const USE_SERVER = true;Then set the engine call in export-browser.ts to this, so that it reads no Vite variable either:
const exportEngine = await CreativeEngine.init({ license: 'YOUR_CESDK_LICENSE_KEY', baseURL: '/assets', featureFlags: { exportWorker: true }});Call exportPhotobook(cesdk) from your own Export button. The kit’s button is part of its React app, so the copied code does not add one. Fill every image slot first: the server stops at an empty slot.
Only rendering moves to the server. The PDF/X conversion always runs in the browser, so the server never needs @imgly/plugin-print-ready-pdfs-web.
Exporting Print-Ready PDFs#
Export produces a PDF/X-4 file with a FOGRA39 output intent.
In your own project this is a second step, not something export does for you. It needs @imgly/plugin-print-ready-pdfs-web from Print Ready PDF above.
Copy toPrintReadyPDF and its worker from the kit:
git clone --depth 1 --branch release-1.87.0-rc.3 https://github.com/imgly/starterkit-photobook-editor-react-web.git
mkdir -p photobook-export
cp starterkit-photobook-editor-react-web/src/client/src/app/print-ready-pdf.ts starterkit-photobook-editor-react-web/src/client/src/app/pdfx.worker.ts ./photobook-export/
rm -rf starterkit-photobook-editor-react-webgit clone --depth 1 --branch release-1.87.0-rc.3 https://github.com/imgly/starterkit-photobook-editor-react-web.git
mkdir -p photobook-export
cp starterkit-photobook-editor-react-web/src/client/src/app/print-ready-pdf.ts starterkit-photobook-editor-react-web/src/client/src/app/pdfx.worker.ts ./photobook-export/
rm -rf starterkit-photobook-editor-react-webThe worker also imports @imgly/pdf-conversion-utils:
npm install @imgly/pdf-conversion-utilsnpm install @imgly/pdf-conversion-utilspnpm add @imgly/pdf-conversion-utilspnpm add @imgly/pdf-conversion-utilsyarn add @imgly/pdf-conversion-utilsyarn add @imgly/pdf-conversion-utilsThe conversion runs Ghostscript in the browser and loads its files from /pdf-conversion/. Copy these files and their license files from the installed package, and repeat this after you update the package:
mkdir -p public/pdf-conversion
for f in worker.browser.js gs.js gs.wasm COPYING.AGPL-3.0 LICENSE.md PROVENANCE.md THIRD_PARTY_NOTICES.md; do cp node_modules/@imgly/pdf-conversion-utils/dist/$f public/pdf-conversion/; donemkdir -p public/pdf-conversion
for f in worker.browser.js gs.js gs.wasm COPYING.AGPL-3.0 LICENSE.md PROVENANCE.md THIRD_PARTY_NOTICES.md; do cp node_modules/@imgly/pdf-conversion-utils/dist/$f public/pdf-conversion/; doneprint-ready-pdf.ts finds these files with a Vite variable. Replace this line:
`${import.meta.env.BASE_URL}pdf-conversion/`,'/pdf-conversion/',Then export the scene to a PDF and convert it:
import type CreativeEditorSDK from '@cesdk/cesdk-js';
import { toPrintReadyPDF } from './print-ready-pdf';
export async function exportPrintReadyPDF(cesdk: CreativeEditorSDK): Promise<Blob> { const scene = cesdk.engine.scene.get(); if (scene == null) throw new Error('There is no scene to export'); const pdf = await cesdk.engine.block.export(scene, { mimeType: 'application/pdf' }); return toPrintReadyPDF(pdf);}Pass an AbortSignal as the second argument of toPrintReadyPDF to cancel the conversion. This step stays in the browser whether or not you added the server.
What the Kit Offers#
- Layouts — a layouts library filtered to the loaded page format. Applying one keeps the content already on the page.
- Auto-fill — photos placed into the book automatically, each one matched to the slot that crops it least, and captions filled from your own copy.
- Validation — a sidebar reporting low-resolution photos, empty slots, and content outside the trim, each one selectable.
- PDF/X compliance — export to PDF/X-4 with a FOGRA39 output intent, the format commercial printers ask for.
Set Up a Scene#
A photobook starts from a template rather than an empty page. The kit opens the scene, then your app puts content into it:
// Any scene URL your asset bundle serves.const sceneURL = `${DEMO_ASSETS_URL}/style-chic-portrait.imgly`;
await initPhotobookEditor(cesdk, sceneURL, options.selectedSize);
const photos = await addPhotosToUploadSource( cesdk.engine, examplePhotos, uploadedFiles);
// Skip both calls to let the reader place every photo by hand.autoFillPhotobook(cesdk.engine, photos);autoFillPhotobookTexts(cesdk.engine, exampleTexts);In short: the scene decides the book, and filling it is your app’s job.
initPhotobookEditortakes the scene URL and the page size. It reads the page format from the scene.- Adding a style means adding its scene to your asset bundle.
addPhotosToUploadSourceis where your own photos come in.- Both auto-fill helpers touch only blocks the template marked as placeholders.
- Size and style come from the start screen, configured in the kit’s
src/client/src/app/photobook-options.ts.
The style scenes are saved as spreads. The jacket comes first, as one spread of the back cover, the spine and the front cover, and the inside pages follow two by two. The editor numbers the pages through the book, so the jacket holds pages 1 to 3 and the first inside page is page 4.
The scene also decides what the reader may do with each spread and page. The jacket’s pages allow selecting only, so a reader cannot put a layout on them or drag them into another order. The inside pages also allow adding content, and the inside spreads allow moving, so a reader can reorder them behind the jacket. The kit opens the editor as an Adopter whose adding defers to each block, in imgly/config/design-editor/settings.ts, and a spread the reader adds with Add Page takes the permissions of the book’s own spreads, in imgly/add-spread.ts.
To turn a book of single pages into spreads, move each page into its spread with engine.block.movePageSliceIntoPage(page, spread, index), then save the scene. A spread is a page with page slices, see Folded Products and Spreads. Check the texts whose width or height is set to Auto afterwards: the move places each of them at the top left corner of its new page. In our style scenes, the spine title moved by up to 289 mm, and the cover title and subtitle of the playful scenes by up to 264 mm. Texts with a fixed size keep their place. Give such a text a fixed size before the move, or set its position again after it.
Customize#
Layouts#
The layouts library is a CE.SDK asset source. Choosing a layout re-lays out the current page instead of inserting a block, and switching to a layout with fewer slots does not discard photos — the extras move to a per-page stash and flow back when a larger layout returns.
Layouts are authored per page format. Each format has its own directory with its own content.json, scenes, and thumbnails:
layouts/├── a4/ # content.json, scenes/, thumbnails/├── a4-landscape/ # content.json, scenes/, thumbnails/├── portrait/ # content.json, scenes/, thumbnails/└── square/ # content.json, scenes/, thumbnails/To add a layout, add its scene to your asset bundle and its entry to that format’s content.json:
{ "id": "portrait-001", "label": { "en": "Title" }, "groups": ["Titles"], "meta": { "blockType": "acme.layouts", "thumbUri": "{{base_url}}/portrait/thumbnails/portrait-001.png", "uri": "{{base_url}}/portrait/scenes/portrait-001.blocks" }}Keep the blockType value as shown: every layout entry in the kit uses acme.layouts.
Authoring a Layout Scene#
A layout scene holds one page’s worth of slots, and the kit reads it as the page’s new content. Four rules make it behave once applied:
- One page per scene. The kit swaps the page’s children, so a scene with two pages contributes only the first.
- Mark every slot as a placeholder. Auto-fill, the layout stash, and the
placeholderImageandplaceholderTextchecks all key off the placeholder flag. A slot without it is never filled and never reported. - Author at the format’s page size. Layouts live under the format directory whose pages they were drawn for; a scene drawn at another size arrives scaled.
- Give text slots their default copy. The
placeholderTextcheck compares the text against what the template shipped, so unedited captions are reported.
Photos reach the pages in the order given, but within a page auto-fill assigns them by shape, not position: it pairs the photos with the slots that crop them least. Slot geometry therefore decides which photo lands where.
Validation#
Validation runs against the book while the reader edits it and reports what would go wrong in print. Eight checks ship with the kit:
| Check | Fires when |
|---|---|
outsidePage |
An element sits completely outside the page |
protrudesFromPage |
An element extends beyond the page edge |
lowResolution |
A photo is too small for its printed size |
bleedMargin |
An element crosses the bleed margin |
duplicateImage |
The same photo appears more than once |
emptyPage |
A page has no content yet |
placeholderImage |
An image slot has no photo yet |
placeholderText |
Text still shows its placeholder content |
The detectors live in imgly/validation.ts and report independently of any UI. Adding a check means adding its detector there, and a name and description for it wherever your interface presents the results — in this kit, src/client/src/app/validation-config.ts.
Print Export#
Export produces a PDF/X-4 file with a FOGRA39 output profile, set in PDFX_OPTIONS in the kit’s src/client/src/app/print-ready-pdf.ts. The scene renders to a standard PDF first, then convertToPDFX from @imgly/plugin-print-ready-pdfs-web converts it.
Theming and Localization#
Match the editor to your brand by setting a theme in the editor configuration. See Theming for the full set of variables.
The kit’s own strings live in imgly/config/design-editor/i18n.ts. Add a locale there alongside the editor’s built-in translations. See Localization.
Key Capabilities#
The Photobook Editor covers the path from a folder of photos to a file a printer accepts.
Layouts Library
Swap a page between authored layouts. Photos and captions carry over, and extras wait in a stash until a larger layout takes them back.
Photo Auto-Fill
Place uploaded photos into the book automatically, matching each photo to the slot whose shape crops it least.
Styled Templates
Start every book from a real scene, authored per page format and style, instead of from a blank canvas.
Design Validation
Catch low-resolution photos, off-page content, and bleed-margin problems while the reader can still fix them.
Print-Ready Export
Export PDF/X-4 with a FOGRA39 output intent, the format commercial printers ask for.
Multiple Book Formats
Offer portrait, square, A4 and A4 landscape books at several sizes, each with its own layouts and its own style scenes.
Troubleshooting#
Editor doesn’t load#
- Check the editor size: Ensure the element that holds the editor is in the DOM and has a visible width and height
- Verify the baseURL: Engine assets must be reachable from the CDN or your self-hosted location
- Check console errors: Look for CORS or network errors in browser developer tools
Layouts or example photos don’t appear#
- Check the demo asset location: The layouts, style scenes, and example photos come from a separate bundle. The kit derives their root from the scene URL you pass to
initPhotobookEditor, so check that URL, orVITE_DEMO_ASSETS_BASE_URLwhen you run the kit as-is - Check network requests: Open the DevTools Network tab and look for failed requests to the asset host
- Self-host assets for production: See Serve Assets to host assets on your infrastructure
Layouts don’t fill with photos#
- Check the layout’s placeholders: Auto-fill only touches blocks the layout scene marked as placeholders. A layout authored without them stays empty. See Placeholders
Export is slow or blocks the editor#
- Move rendering to the server: A large book competes with the editor for the main thread. Run the export server and route exports through it
- Wait for content to load: Ensure photos are fully loaded before exporting
- Check CORS on images: Remote photos must allow cross-origin access
Watermark appears in production#
- Add your license key: Set the
licenseproperty in your configuration - Get a license: Contact us at img.ly/forms/contact-sales/
API Reference#
Most of what you need is four calls: open a scene, give it photos, fill it, and export it for print.
| Call | What it does |
|---|---|
initPhotobookEditor(cesdk, sceneURL, size) |
Opens a photobook. Configures the editor, loads the scene, and offers the layouts matching the scene’s page format |
addPhotosToUploadSource(engine, remotePhotos, files) |
Fills the upload source with the photos the book may use, and returns them for auto-fill |
autoFillPhotobook(engine, photos) |
Fills every empty slot, matching each photo to the slot whose shape crops it least |
toPrintReadyPDF(pdf, signal?) |
Converts an exported PDF to print-ready PDF/X-4. From the kit’s src/client/src/app/print-ready-pdf.ts |
Two more worth knowing:
VALIDATION_CHECKSinimgly/validation.ts— the print validation checks, each with the rule it applies. This is where you add a check of your own or drop one you do not want.enterPreviewMode(cesdk, options)— switches the editor to the read-only preview configuration, one spread at a time, and resolves to the function that switches back.
Everything else is exported from imgly/index.ts:
| Export | Kind | What it does |
|---|---|---|
initPhotobookEditor(cesdk, sceneURL, size) |
function | Configures a CE.SDK instance for photobook editing: adds the editor configuration and asset source plugins, loads the scene, registers the layouts library for the format read from the front cover, and stamps the template’s default texts |
DesignEditorConfig |
class | The editor configuration plugin. Adds the actions, features, translations, settings, keyboard shortcuts, and UI layout. Add it with cesdk.addPlugin(new DesignEditorConfig()) |
configurePhotobookEditor(cesdk) |
function | Adds DesignEditorConfig with the asset sources and the photo upload source. The kit calls it on open and when the reader leaves the preview |
PhotobookPreviewConfig |
class | The preview configuration plugin: a read-only editor with buttons to page through the book, go back, and export |
UPLOAD_SOURCE_ID |
constant | The id of the asset source the reader’s photos go into, ly.img.image.upload |
revokeUploadedPhotoURLs() |
function | Releases the object URLs created for uploaded files and drops their cached resolutions. Call it when the editor closes |
PhotoRef |
type | A photo available for filling the book: uri, width, height |
RemotePhotoAsset |
type | A remote example photo with known pixel dimensions, plus id, label, and thumbUri |
autoFillPhotobook(engine, photos) |
function | Fills every placeholder image slot in the book, matching each photo to the slot whose shape crops it least |
autoFillPhotobookTexts(engine, texts) |
function | Writes caption copy into the placeholder text blocks, page by page |
PhotobookTextContent |
type | The copy an auto-filled book is written with: { captions: string[] } |
enterPreviewMode(cesdk, options) |
function | Switches the editor to PhotobookPreviewConfig, showing one spread at a time, and resolves to the function that switches back to the design editor on the page it showed. Preview writes go into a scratch history, so the preview leaves no undo steps behind |
LAYOUTS_SOURCE_ID |
constant | The id of the layouts asset source, ly.img.layouts |
LayoutsAssetSourcePlugin |
class | Registers the layouts library for one page format. Applying a layout re-lays out the current page and carries its photos and text into the new slots |
getLayoutFormat(size) |
function | Returns the page format whose aspect ratio is closest to a size: portrait, square, a4 or a4-landscape |
getSceneLayoutFormat(engine) |
function | Returns the page format of the loaded scene, read from its front cover |
assetsBaseURLOf(sceneURL) |
function | Returns the asset root a scene hangs off: its parent directory |
addPhotosToUploadSource(engine, remotePhotos, files) |
function | Adds photos to the upload source and returns them, the reader’s files first |
getStyleSceneURL(assetsBaseURL, format, styleId) |
function | Returns the scene URL a size and style combination starts from |
PhotobookSize |
type | A page format in millimeters: { width, height } |
PhotobookStyleId |
type | 'playful' | 'chic' |
PhotoDistributionId |
type | 'autoFill' | 'byHand' |
Next Steps#
- Configuration – Complete list of initialization options
- Serve Assets – Self-host engine assets for production
- Print Ready PDF – More on PDF/X conversion
- Placeholders – Author the slots layouts fill
- Theming – Customize colors and appearance
- Localization – Add translations and language support