@imgly/plugin-print-ready-pdfs-web 0.1.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0-rc.1] - 2025-10-16
9
+
10
+ ### Added
11
+
12
+ - Initial release candidate for Print-Ready PDFs plugin
13
+ - Full PDF/X-3:2003 compliance with RGB to CMYK conversion
14
+ - Three bundled ICC profiles:
15
+ - FOGRA39 (ISO Coated v2) - European printing standard
16
+ - GRACoL 2013 - US commercial printing standard
17
+ - sRGB IEC61966-2.1 - Digital/web distribution
18
+ - Custom ICC profile support for specialized printing requirements
19
+ - Function overloading for batch PDF processing
20
+ - Configurable OutputIntent metadata (identifier and description)
21
+ - Transparency flattening control (enabled by default for PDF/X-3 compliance)
22
+ - Browser-based PDF processing (100% client-side, no server required)
23
+ - Node.js compatibility
24
+
25
+ ### Notes
26
+
27
+ - This is a release candidate for testing and feedback
28
+ - Source code available at: https://github.com/imgly/plugins
29
+ - Ghostscript WASM components are AGPL-3.0 licensed
30
+ - Client-side execution model minimizes AGPL compliance concerns
31
+ - For commercial licensing guidance, consult legal counsel or contact IMG.LY support
package/LICENSE.md ADDED
@@ -0,0 +1,25 @@
1
+ The licensed code may be used by the customer solely in connection with an IMG.LY licensed product and for commercial purposes under the terms set forth in this [agreement](https://img.ly/tos). Any other use of the licensed code is strictly prohibited unless otherwise agreed in writing by IMG.LY.
2
+
3
+ ## Additional Information
4
+
5
+ ### CE.SDK PDFX Plugin Demo
6
+
7
+ This demo uses components with different licenses:
8
+
9
+ #### CE.SDK (Commercial)
10
+
11
+ - Requires valid license key for production use
12
+ - Get your license: https://img.ly/
13
+
14
+ #### PDFX Plugin (AGPL-3.0)
15
+
16
+ - Uses Ghostscript WASM (AGPL-3.0 licensed)
17
+ - Free for open source and internal use
18
+ - Commercial distribution may require compliance
19
+
20
+ #### Demo Application (MIT)
21
+
22
+ - Demo code provided as example integration
23
+ - Free to use and modify
24
+
25
+ For commercial licensing guidance, consult with legal counsel or contact IMG.LY support.
package/README.md ADDED
@@ -0,0 +1,422 @@
1
+ # @imgly/plugin-print-ready-pdfs-web
2
+
3
+ **Transform CE.SDK PDFs into Print-Ready CMYK Files**
4
+
5
+ Convert CE.SDK's standard PDF exports into fully **PDF/X-3 compliant, CMYK-based print-ready files** with embedded ICC output intents. This plugin hooks directly into CE.SDK's export process, ensuring your designs are automatically prepared for professional commercial printing workflows.
6
+
7
+ ## The Problem
8
+
9
+ Your users design beautiful materials in CE.SDK. But professional printing requires specific PDF standards:
10
+
11
+ - CMYK color space instead of RGB
12
+ - PDF/X-3 or PDF/X-4 compliance
13
+ - Embedded ICC color profiles for accurate color reproduction
14
+
15
+ ## The Solution
16
+
17
+ This plugin automatically converts CE.SDK's RGB PDFs into print-ready files that meet professional printing requirements:
18
+
19
+ - ✅ **CMYK Color Space**: Converts RGB to CMYK using professional ICC profiles
20
+ - ✅ **PDF/X Standards**: Generates PDF/X-3 compliant files for commercial printing
21
+ - ✅ **Color Profile Support**: Embeds industry-standard or custom ICC profiles
22
+ - ✅ **100% Client-Side**: Everything runs in the browser—zero backend infrastructure
23
+ - ✅ **Drop-in Integration**: One function call transforms any PDF
24
+
25
+ ## Key Features
26
+
27
+ - **Drop-in Replacement**: Works seamlessly with CE.SDK's existing export functionality
28
+ - **100% Client-Side**: All processing happens in the browser—no server infrastructure required
29
+ - **Industry Profiles Included**: Ships with FOGRA39 (Europe), GRACoL 2013 (US), and sRGB profiles
30
+ - **Custom Profile Support**: Bring your own ICC profile to match sophisticated print pipelines
31
+ - **PDF/X-3 Compliant**: Generates files that meet commercial printing standards
32
+
33
+ ## Installation
34
+
35
+ ```bash
36
+ npm install @imgly/plugin-print-ready-pdfs-web
37
+ ```
38
+
39
+ ## Quick Start
40
+
41
+ Just one function call transforms any PDF into a print-ready file:
42
+
43
+ ```javascript
44
+ import { convertToPDFX3 } from '@imgly/plugin-print-ready-pdfs-web';
45
+
46
+ // Convert CE.SDK's RGB PDF to print-ready CMYK
47
+ const printReadyPDF = await convertToPDFX3(pdfBlob, {
48
+ outputProfile: 'fogra39', // European printing standard
49
+ title: 'My Print Document',
50
+ });
51
+
52
+ // That's it! The PDF is now ready for professional printing
53
+ ```
54
+
55
+ ## Drop-in CE.SDK Integration
56
+
57
+ Add print-ready export to your existing CE.SDK implementation with minimal code changes:
58
+
59
+ ```javascript
60
+ import CreativeEditorSDK from '@cesdk/cesdk-js';
61
+ import { convertToPDFX3 } from '@imgly/plugin-print-ready-pdfs-web';
62
+
63
+ const config = {
64
+ license: 'your-cesdk-license',
65
+ ui: {
66
+ elements: {
67
+ navigation: {
68
+ action: {
69
+ custom: [
70
+ {
71
+ label: 'Export Print-Ready PDF',
72
+ iconName: '@imgly/icons/Essentials/Download',
73
+ callback: async () => {
74
+ const sceneId = cesdk.engine.scene.get();
75
+ const pdfBlob = await cesdk.engine.block.export(
76
+ sceneId,
77
+ 'application/pdf'
78
+ );
79
+ const printReadyBlob = await convertToPDFX3(pdfBlob, {
80
+ outputProfile: 'fogra39',
81
+ title: 'Print-Ready Export',
82
+ });
83
+
84
+ // Download
85
+ const url = URL.createObjectURL(printReadyBlob);
86
+ const link = document.createElement('a');
87
+ link.href = url;
88
+ link.download = 'design-print-ready.pdf';
89
+ link.click();
90
+ URL.revokeObjectURL(url);
91
+ },
92
+ },
93
+ ],
94
+ },
95
+ },
96
+ },
97
+ },
98
+ };
99
+
100
+ const cesdk = await CreativeEditorSDK.create('#editor', config);
101
+ ```
102
+
103
+ ## API Reference
104
+
105
+ ### `convertToPDFX3(pdf, options)` / `convertToPDFX3(pdfs, options)`
106
+
107
+ Converts RGB PDF(s) to print-ready format. This function supports both single PDF conversion and batch processing through function overloading.
108
+
109
+ **Single PDF Conversion:**
110
+
111
+ ```typescript
112
+ convertToPDFX3(pdf: Blob, options: PDFX3Options): Promise<Blob>
113
+ ```
114
+
115
+ **Parameters:**
116
+ - `pdf` (Blob): Input PDF file as a Blob object
117
+ - `options` (PDFX3Options): Conversion configuration
118
+
119
+ **Returns:** Promise<Blob> - The print-ready PDF file
120
+
121
+ **Batch Processing:**
122
+
123
+ ```typescript
124
+ convertToPDFX3(pdfs: Blob[], options: PDFX3Options): Promise<Blob[]>
125
+ ```
126
+
127
+ **Parameters:**
128
+ - `pdfs` (Blob[]): Array of input PDF files as Blob objects
129
+ - `options` (PDFX3Options): Conversion configuration (applied to all PDFs)
130
+
131
+ **Returns:** Promise<Blob[]> - Array of print-ready PDF files
132
+
133
+ **Options Interface:**
134
+
135
+ ```typescript
136
+ interface PDFX3Options {
137
+ // Required
138
+ outputProfile: 'gracol' | 'fogra39' | 'srgb' | 'custom';
139
+
140
+ // Optional
141
+ customProfile?: Blob; // Required only if outputProfile is 'custom'
142
+ title?: string; // Document title
143
+ outputConditionIdentifier?: string; // ICC profile identifier for OutputIntent
144
+ outputCondition?: string; // Human-readable output condition description
145
+ flattenTransparency?: boolean; // Flatten transparency (default: true for PDF/X-3)
146
+ }
147
+ ```
148
+
149
+ **Note:** Batch processing handles each PDF sequentially to avoid overwhelming the WASM module.
150
+
151
+ **OutputIntent Metadata:**
152
+
153
+ The `outputConditionIdentifier` and `outputCondition` fields control the PDF/X-3 OutputIntent metadata:
154
+
155
+ - **Built-in profiles** (fogra39, gracol, srgb): Use preset values automatically (e.g., "FOGRA39", "ISO Coated v2 (ECI)")
156
+ - **Custom profiles**: Specify your own identifiers and descriptions
157
+ - Both fields are optional and have sensible defaults
158
+
159
+ ### Included Color Profiles
160
+
161
+ The plugin ships with industry-standard ICC profiles for immediate use:
162
+
163
+ | Profile | Purpose | Standard |
164
+ | ----------- | ------------------------------- | ------------------------------------------------- |
165
+ | `'fogra39'` | European CMYK printing standard | FOGRA39 (ISO Coated v2) - Offset printing profile |
166
+ | `'gracol'` | US CMYK printing standard | GRACoL 2013 - Commercial printing profile |
167
+ | `'srgb'` | Digital/web distribution | sRGB - When CMYK conversion isn't required |
168
+ | `'custom'` | Specific color requirements | Load any ICC profile for exact color matching |
169
+
170
+ ## Real-World Usage
171
+
172
+ ### High-Level CE.SDK Export API
173
+
174
+ The simplest way to integrate with CE.SDK's high-level export function:
175
+
176
+ ```javascript
177
+ import CreativeEditorSDK from '@cesdk/cesdk-js';
178
+ import { convertToPDFX3 } from '@imgly/plugin-print-ready-pdfs-web';
179
+
180
+ const cesdk = await CreativeEditorSDK.create('#editor', config);
181
+
182
+ // Export and convert to print-ready in one flow
183
+ const { blobs } = await cesdk.export({
184
+ mimeType: 'application/pdf'
185
+ });
186
+
187
+ // Function overloading automatically handles array input
188
+ const printReadyBlobs = await convertToPDFX3(blobs, {
189
+ outputProfile: 'fogra39',
190
+ title: 'Print-Ready Export',
191
+ });
192
+
193
+ // Download the first print-ready PDF
194
+ const url = URL.createObjectURL(printReadyBlobs[0]);
195
+ const link = document.createElement('a');
196
+ link.href = url;
197
+ link.download = 'design-print-ready.pdf';
198
+ link.click();
199
+ URL.revokeObjectURL(url);
200
+ ```
201
+
202
+ ### Professional Printing Requirements
203
+
204
+ ```javascript
205
+ import { convertToPDFX3 } from '@imgly/plugin-print-ready-pdfs-web';
206
+
207
+ // Your user designed materials in CE.SDK
208
+ const designPDF = await cesdk.engine.block.export(sceneId, 'application/pdf');
209
+
210
+ // Convert to print-ready format with CMYK and PDF/X-3 compliance
211
+ const printReadyPDF = await convertToPDFX3(designPDF, {
212
+ outputProfile: 'fogra39', // Industry-standard CMYK profile
213
+ title: 'Marketing Materials - Q4 2024',
214
+ });
215
+
216
+ // PDF now meets professional printing requirements
217
+ ```
218
+
219
+ ### Regional Color Standards
220
+
221
+ ```javascript
222
+ // US Commercial Printing Standard
223
+ const usPrintReady = await convertToPDFX3(pdfBlob, {
224
+ outputProfile: 'gracol', // GRACoL 2013 CMYK profile
225
+ title: 'US Print Production',
226
+ });
227
+
228
+ // European Printing Standard
229
+ const euPrintReady = await convertToPDFX3(pdfBlob, {
230
+ outputProfile: 'fogra39', // FOGRA39 CMYK profile
231
+ title: 'EU Print Production',
232
+ });
233
+ ```
234
+
235
+ ### Custom Color Profiles
236
+
237
+ Bring your own ICC profile for specialized printing requirements:
238
+
239
+ ```javascript
240
+ // Load a specific ICC profile for exact color requirements
241
+ const customProfile = await fetch('/profiles/custom-cmyk-profile.icc').then(
242
+ (r) => r.blob()
243
+ );
244
+
245
+ const printReadyPDF = await convertToPDFX3(pdfBlob, {
246
+ outputProfile: 'custom',
247
+ customProfile: customProfile,
248
+ title: 'Specialized Print Output',
249
+ outputConditionIdentifier: 'Custom_Newsprint_CMYK',
250
+ outputCondition: 'Custom newsprint profile for high-speed web press'
251
+ });
252
+
253
+ // PDF now uses your exact CMYK color profile with custom metadata
254
+ ```
255
+
256
+ **Override Built-in Profile Metadata:**
257
+
258
+ You can also override the metadata for built-in profiles:
259
+
260
+ ```javascript
261
+ const printReadyPDF = await convertToPDFX3(pdfBlob, {
262
+ outputProfile: 'fogra39',
263
+ title: 'Custom FOGRA39 Variant',
264
+ outputConditionIdentifier: 'FOGRA39_Modified',
265
+ outputCondition: 'Modified ISO Coated v2 for specific press'
266
+ });
267
+ ```
268
+
269
+ ### Batch Processing
270
+
271
+ Process multiple PDFs using the overloaded function:
272
+
273
+ ```javascript
274
+ import { convertToPDFX3 } from '@imgly/plugin-print-ready-pdfs-web';
275
+
276
+ // Array input automatically triggers batch processing (sequential)
277
+ const printReadyPDFs = await convertToPDFX3(pdfBlobs, {
278
+ outputProfile: 'gracol',
279
+ title: 'Batch Export',
280
+ });
281
+
282
+ // Or process in parallel for maximum speed (use with caution for large files)
283
+ const printReadyPDFs = await Promise.all(
284
+ pdfBlobs.map((pdf) =>
285
+ convertToPDFX3(pdf, {
286
+ outputProfile: 'gracol',
287
+ title: 'Batch Export',
288
+ })
289
+ )
290
+ );
291
+ ```
292
+
293
+ **Note:** When passing an array, PDFs are processed sequentially to avoid overwhelming the WASM module. For parallel processing, use `Promise.all` with individual calls. Sequential processing is recommended for reliability.
294
+
295
+ ## Testing
296
+
297
+ Test the integration with a complete CE.SDK example:
298
+
299
+ ```bash
300
+ # Start the test server
301
+ npm run test:cesdk
302
+
303
+ # Open http://localhost:3001 in your browser
304
+ # Create designs and export with different print profiles
305
+ ```
306
+
307
+ The test interface includes:
308
+
309
+ - Live CE.SDK editor
310
+ - Navigation bar with print-ready export options
311
+ - Real-time conversion and download
312
+
313
+ ## PDF/X-3 Compliance Details
314
+
315
+ The plugin ensures full PDF/X-3:2003 compliance by:
316
+
317
+ ### OutputIntent
318
+
319
+ Every converted PDF includes a properly configured OutputIntent entry with:
320
+ - **DestOutputProfile**: The embedded ICC profile data
321
+ - **OutputConditionIdentifier**: Standard identifier (e.g., "FOGRA39", "GRACoL 2013")
322
+ - **OutputCondition**: Human-readable description of the printing condition
323
+ - **S**: Set to `/GTS_PDFX` for PDF/X-3 standard
324
+
325
+ ### Trapped Entry
326
+
327
+ The `/Trapped` field is automatically set to `/False` in the PDF document info dictionary, indicating that trapping operations have not been performed. This is the correct value since the plugin performs color conversion but does not apply trapping.
328
+
329
+ Per the PDF/X-3 specification, this field must be set to either `/True` or `/False` (not `/Unknown`).
330
+
331
+ ### Text and Vector Preservation
332
+
333
+ Text and vector graphics are preserved in their original vector format during conversion. Only the color space is converted from RGB to CMYK—no rasterization occurs for non-transparent content.
334
+
335
+ ### Transparency Handling
336
+
337
+ **Important:** PDF/X-3:2003 does not support transparency. By default, the plugin flattens all transparency to ensure compliance:
338
+
339
+ ```javascript
340
+ // Default behavior - flattens transparency (PDF/X-3 compliant)
341
+ const printReadyPDF = await convertToPDFX3(pdfBlob, {
342
+ outputProfile: 'fogra39',
343
+ title: 'Print Ready',
344
+ // flattenTransparency: true (default)
345
+ });
346
+ ```
347
+
348
+ **Transparency Flattening Behavior:**
349
+ - **Pages with transparency** → Rasterized to bitmap at high resolution
350
+ - **Pages without transparency** → Preserved as vectors (text, shapes remain editable)
351
+ - **Mixed content** → Only transparent elements are rasterized
352
+
353
+ **For Maximum Quality:**
354
+
355
+ If your CE.SDK exports contain no transparency, you can disable flattening to preserve all vectors:
356
+
357
+ ```javascript
358
+ // Disable flattening for transparent-free PDFs (best quality)
359
+ const printReadyPDF = await convertToPDFX3(pdfBlob, {
360
+ outputProfile: 'fogra39',
361
+ title: 'Vector Preserved',
362
+ flattenTransparency: false, // Preserves vectors, but may not be PDF/X-3 compliant if transparency exists
363
+ });
364
+ ```
365
+
366
+ **⚠️ Important:** Only disable `flattenTransparency` if you're certain your PDFs contain no transparency. PDFs with transparency and `flattenTransparency: false` will fail PDF/X-3 validation.
367
+
368
+ **Avoiding Transparency in CE.SDK:**
369
+ - Use 100% opacity for all elements
370
+ - Avoid alpha channel PNG images
371
+ - Use solid fills instead of gradient opacity
372
+ - Export without blend modes
373
+
374
+ ## Known Limitations
375
+
376
+ - **Transparency**: PDF/X-3:2003 does not support transparency. Pages containing transparency (alpha channels, soft masks, opacity < 1.0) will be rasterized to bitmaps during conversion to ensure compliance. To preserve vectors, avoid transparency in your CE.SDK designs.
377
+ - **Spot Colors**: Currently, spot colors (Pantone, custom inks) are converted to CMYK during the PDF/X-3 conversion process. This is a limitation of the current Ghostscript WASM implementation. If preserving spot colors is critical for your workflow, consider server-side PDF processing solutions.
378
+ - **PDF/X Versions**: Only supports PDF/X-3:2003 (not X-1a or X-4 yet)
379
+
380
+ ## License Considerations
381
+
382
+ This plugin uses Ghostscript WebAssembly (AGPL-3.0 licensed) with **client-side browser execution**:
383
+
384
+ ### How It Works
385
+
386
+ - Ghostscript WASM loads dynamically in the user's browser
387
+ - All PDF processing happens client-side on the user's device
388
+ - No AGPL code runs on your servers
389
+ - Similar to users installing a browser extension
390
+
391
+ ### Usage Guidelines
392
+
393
+ ✅ **Generally Safe For:**
394
+
395
+ - Open source projects
396
+ - Internal/private applications
397
+ - Commercial websites (processing happens in user's browser)
398
+ - SaaS applications (no server-side AGPL code execution)
399
+
400
+ ⚠️ **Considerations:**
401
+
402
+ - If you bundle/modify the WASM module directly
403
+ - If you prevent users from accessing the source
404
+ - If you process PDFs server-side
405
+
406
+ ### Why Browser Execution Matters
407
+
408
+ Since the AGPL-licensed Ghostscript runs entirely in the end user's browser rather than as a network service:
409
+
410
+ 1. Your servers never execute AGPL code
411
+ 2. You're not providing a "network service" under AGPL terms
412
+ 3. The architecture is similar to CDN-delivered JavaScript libraries
413
+
414
+ For specific legal guidance, consult with legal counsel. For technical questions, contact IMG.LY support.
415
+
416
+ ## Support
417
+
418
+ For questions about CE.SDK integration or print workflows:
419
+
420
+ - [CE.SDK Documentation](https://img.ly/docs)
421
+ - [GitHub Issues](https://github.com/imgly/plugins/issues)
422
+ - [IMG.LY Support](https://img.ly/support)
Binary file
Binary file