Release Upgrade Notes
This page records public API and module-level upgrade changes for @mlightcad/cad-simple-viewer, @mlightcad/cad-editor, and related packages, organized by release. For how to move the whole package set to a target version, see the Synchronized Upgrade Guide.
Latest: Options, PICKBOX, and default navigation quality
PICKBOX matches AutoCAD height semantics
Starting with the release that includes this change (and a matching @mlightcad/data-model), PICKBOX is the full object-selection target height in pixels — the same meaning as AutoCAD — not a half-size. The default changes from 10 to AutoCAD’s 3 (range 0–50). The Options dialog preview, crosshair pickbox, and pick hit radius (selectionBoxSize = PICKBOX / 2) all follow that value. If you previously stored a large PICKBOX under the old half-size interpretation, re-tune it after upgrading.
Default pan/orbit quality is full detail
Starting with the release that includes this change, AcApSettings.navigationQuality defaults to quality (was performance) so middle-button pan keeps all detail. Performance / Balanced still hide objects under 6 / 3 pixels while gesturing. Options → Display and the status-bar Orbit menu share the same three-way control.
Migrate hosts that relied on the old always-on culling default:
configure({ defaults: { navigationQuality: 'performance' } })before first accessingAcApSettingManager.instance.- Drop any use of the short-lived
isNavigationLodEnabledsetting if you adopted a preview build; stored copies are stripped on load.
Configurable mouse bindings
The release also adds AcApSettings.mouseBindings. The built-in gestures preserve the previous controls. Code constructing a complete AcApSettings object must add mouseBindings, for example mouseBindings: acapDefaultMouseBindings(); callers using Partial<AcApSettings> need no change. Hosts can use acapResolveMouseBindings to validate partial defaults before passing them to configure. Saved mouse preferences override host defaults; restoring built-in defaults in the dialog saves those defaults as the user's preference.
1.8.2: Navigation and UCS preferences
This release adds the AcApSettings.navigationQuality preference and host defaults through AcApSettingManager.configure({ defaults }). Existing hosts need no migration: built-in defaults apply automatically, user preferences override host defaults, and the new free-orbit methods on AcTrView2d are additive. Configure host defaults before first accessing AcApSettingManager.instance. See also the Default pan/orbit quality is full detail note above for the later default change.
Settings migration
The old boolean navigationPerformance setting is migrated automatically to navigationQuality (true → 'performance', false → 'quality'), and the obsolete ucsIconVisible / ucsIconOpacity keys are removed. Users do not need to clear localStorage.
ViewCube navigation, UCS display, and UI commands
This release adds AutoCAD-style ViewCube 3D navigation (26 clickable faces / edges / corners, drag orbit, SW isometric home), new additive AcTrView2d APIs such as canOrbit, isFreeOrbit, and setFreeOrbitEnabled, and shows the UCS icon Z axis when the view is tilted.
@mlightcad/cad-simple-viewer also registers COMMANDLINE / COMMANDLINEHIDE, RIBBON / RIBBONCLOSE, and SHORTCUTTOOLBAR / SHORTCUTTOOLBARHIDE, and adds the read-only RIBBONSTATE system variable (always kept in sync with isShowRibbon).
isShowShortCutToolbar is now honored only on handheld devices, and isShowViewCubeCompass only on desktop browsers; both use device type rather than viewport width. Existing hosts need no migration.
1.8.1: Visual styles and shading
SHADEMODE / VSCURRENT
This release registers SHADEMODE (alias SHADE) and VSCURRENT (alias VS), which switch sub-mesh drawing between 2Dwireframe / 3Dwireframe / Gouraud, and adds AcApVisualStyleService and ACAP_MESH_VISUAL_STYLE_PRESETS in @mlightcad/cad-simple-viewer. The visual style is written to the drawing's ACAD_VISUALSTYLE dictionary and the active viewport's renderMode, and round-trips through DXF.
Hatch background color HPBACKGROUNDCOLOR now carries through the viewer, PDF, and HTML export. There are no breaking host API changes in this release; data-model / libredwg-converter / libredwg-web move together to 1.16.9 / 3.16.9 / 0.9.6.
1.8.0: Plugin UI, PDF import/export, groups and arrays
Plugin UI comes from AcApUiRegistry
Starting with the release that includes this change, ribbon groups, File → Export rows, simple-UI toolbar buttons, and palette tabs that belong to a plugin are declared by that plugin's /register module through AcApUiRegistry. The host draws whatever is registered. A package that is not installed contributes no UI.
Migrate hosts and plugins:
@mlightcad/cad-editorno longer hardcodes Agent, model settings, script, PDF, HTML, or SVG buttons. It loads@mlightcad/cad-pdf-plugin/register,@mlightcad/cad-html-plugin/register, and@mlightcad/cad-svg-plugin/registerwith dynamicimport(), the same way it already loads the agent, LLM, script, and PaddleOCR packages. Keep those specifiers external when bundling the editor.- The
store.featuresflags (agentPlugin,llmPlugin,paddleOcrPlugin,scriptPlugin) are removed. - A plugin calls
AcApUiRegistry.registerfrom/registerwith ribbon groups,file.exportmenu rows, a palettemount, and locale messages. The button exists as soon as/registerruns. The heavy module still loads on the command. - Simple UI builds its export menu and extra toolbar buttons from the same registry. Remove handwritten Agent and Script toolbar items.
setAgentPaletteOpenerandsetCadScriptPaletteOpenerremain for hosts that do not open registry palette ids.cad-editorand simple UI open those ids themselves.chtmlandcpdfopen framework-free dialogs that live incad-html-pluginandcad-pdf-plugin./registerclaims those commands in the browser; OK loads the plugin through-chtml/-cpdf. Headless hosts passdialog: falsesochtmlandcpdfstay command-line prompts. The Vue dialogsMlExportHtmlDlg/MlExportPdfDlgand the editor command classes are removed.
Simple UI chrome moves into cad-simple-viewer
Starting with the release that includes this change, @mlightcad/cad-simple-ui-plugin is removed. Toolbar presets, dock palette tabs (layers / find / review / measurements), theme sync, and the default AcApPaletteHost live in @mlightcad/cad-simple-viewer (types under src/ui/).
Migrate hosts:
- Uninstall
@mlightcad/cad-simple-ui-pluginand dropacuiRegisterSimpleUiPlugin/acuiCreateSimpleUiPluginimports from that package. - Prefer
AcApDocManager.createInstance({ simpleUi: { … } })(default on). Pass former plugin options throughsimpleUi. UsesimpleUi: falseforcad-editor, CLI, MCP, and other headless hosts. - Import types/helpers from
@mlightcad/cad-simple-viewer(the/simple-uiand/findpackage subpaths are removed). - Await
AcApDocManager.instance.simpleUiReady(or readsimpleUi) instead ofpluginManager.getPlugin('SimpleUiPlugin')/ the formersimpleUiPlugingetter. cad-editorkeeps its Vue layer manager; find / design-review / measurements use the shared DOM palette views.
Dock panel chrome moves to cad-simple-viewer
The plain-DOM dock panel chrome (AcUiDockPanel) lives in @mlightcad/cad-simple-viewer. Built-in simple UI chrome mounts tab content (layers, find, review, measurements) and registers an AcApPaletteHost on that dock; cad-editor registers its Vue tool-palette host instead.
Migrate hosts / plugins:
- Import
AcUiDockPanel,AcUiDockPanelTab, andAcUiDockPanelSidefrom@mlightcad/cad-simple-viewer. - Dock chrome i18n keys live under
main.dockPanel.*(includingmain.dockPanel.tab.layersand friends). AcApPaletteService.openwithout a registered host uses a realAcUiDockPanel(right dock / phone sheet).- Named built-in tabs open through
AcApPaletteService.openNamedTab/ optionalAcApPaletteHost.openNamedTab(ids inACAP_PALETTE_NAMED_TAB) and require a registered host — there is no dock fallback for named tabs. Opens requested before a host is registered are queued and flushed when the host arrives (covers the asyncsimpleUiload gap). Hosted HTMLElement panels still useAcApPaletteService.open.
Local PaddleOCR (@mlightcad/cad-paddleocr-plugin)
Starting with the release that includes this change, hosts can install @mlightcad/cad-paddleocr-plugin for in-browser OCR of exploded PDF text (pdftext / PDF import OCR). It registers the paddleocr recognizer in AcApTextRecognitionService. Wasm and ONNX models load only on the first OCR request. The PDF import “Recognize exploded text” list shows each available OCR option: local PaddleOCR and every configured vision-capable LLM model (e.g. kkidc — model-id), not one row per provider.
Migrate hosts:
- Install
@mlightcad/cad-paddleocr-pluginand callregisterLazyPaddleOcrPluginbeforeregisterLazyLlmPlugin, so unread lines still fall back to the vision LLM.@mlightcad/cad-editordoes this when the package is installed. - Serve ONNX Runtime Web wasm files from a same-origin path (demos use
./vendor/onnxruntime/) and passwasmPathstoregisterLazyPaddleOcrPlugin. AcApTextRecognitionService.has(id)can check whether a given recognizer is registered (for example skip the “OCR not configured” LLM hint whenpaddleocris present).
import { registerLazyPaddleOcrPlugin } from '@mlightcad/cad-paddleocr-plugin/register'
import { registerLazyLlmPlugin } from '@mlightcad/cad-llm-plugin/register'
registerLazyPaddleOcrPlugin(pluginManager, {
wasmPaths: './vendor/onnxruntime/'
})
registerLazyLlmPlugin(pluginManager)Shared AI model settings (@mlightcad/cad-llm-plugin)
Starting with the release that includes this change, the LLM provider settings move out of @mlightcad/cad-agent-plugin into the new @mlightcad/cad-llm-plugin, so the CAD Agent and pdftext text recognition (OCR) share one configuration. The new package adds the LLMSETTINGS command, a framework-free settings dialog (also on the AI ribbon tab of @mlightcad/cad-editor), and @mlightcad/cad-simple-viewer adds AcApLlmSettingsService so any feature can open the dialog or check whether a vision model is configured.
Migrate hosts:
- Install
@mlightcad/cad-llm-plugin(now a peer dependency of@mlightcad/cad-agent-plugin) and callregisterLazyLlmPluginnext toregisterLazyAgentPlugin.@mlightcad/cad-editordoes this on its own when the package is installed. registerLazyAgentPluginno longer registers a text recognizer. The recognizer is nowcad-llm(wascad-agent) and comes fromregisterLazyLlmPlugin.acapAgentRecognizeText/cleanRecognizedTextare nowacapLlmRecognizeText/acapLlmCleanRecognizedTextin@mlightcad/cad-llm-plugin.- The agent panel's inline settings card is replaced by the dialog; its gear button opens LLMSETTINGS.
- Saved settings are kept: the
localStoragekeycad-agent-plugin.llm-configis unchanged. - OCR falls back to the first image-capable configured model when the model in use is text-only.
import { registerLazyAgentPlugin } from '@mlightcad/cad-agent-plugin/register'
import { registerLazyLlmPlugin } from '@mlightcad/cad-llm-plugin/register'
registerLazyLlmPlugin(pluginManager)
registerLazyAgentPlugin(pluginManager)Import PDF: ipdf is now PDFIMPORT / -PDFIMPORT
Starting with the release that includes this change (1.8.0), the PDF import command of @mlightcad/cad-pdf-plugin takes AutoCAD's names:
- PDFIMPORT opens an Import PDF dialog (
AcUiPdfImportDialog) after the file is picked: page with preview, insertion point (X/Y or on-screen), scale and mode (Recover drawing / Keep PDF appearance). - -PDFIMPORT keeps the command-line prompts
ipdfhad (page, insertion point withScaleandMode). Its class isAcApImportPdfPromptCmd.
Migrate: ipdf no longer exists. Scripts that ran executeCommand('ipdf') and answered prompts should run -pdfimport; hosts that render their own ribbon should use pdfimport (the cad-editor ribbon item id is now cmd-pdfimport). The command descriptions move from command.ACAD.ipdf to command.ACAD.pdfimport / command.ACAD.-pdfimport, and the prompt strings from jig.ipdf to jig.pdfimport (dialog strings under jig.pdfimport.dialog). AcApPdfImportConvertor.importFromFilePicker now shows the dialog; importFromCommandLine is the prompt flow.
Smart Blocks: Search and Convert (BSEARCH)
Starting with the release that includes this change, @mlightcad/cad-simple-viewer registers -BSEARCH and @mlightcad/cad-editor adds BSEARCH (alias BCONVERT) with a Search and Convert palette tab (list of found instances) and a Convert to Block dialog (Insert and AI ribbon tabs).
Shape matching moved from @mlightcad/cad-pdf-plugin to @mlightcad/cad-simple-viewer. Migrate imports:
@mlightcad/cad-pdf-plugin (deprecated) | @mlightcad/cad-simple-viewer |
|---|---|
findPdfShapeMatches | acedFindShapeMatches |
applyPdfAffine | acedApplyAffine2d |
pdfEntityToFeature | acedEntityToShapeFeature(entity, id, { matchLayer: false }) |
PdfMatchFeature / PdfAffine / PdfShapeMatch / PdfShapeMatchOptions | AcEdShapeFeature / AcEdAffine2d / AcEdShapeMatch / AcEdShapeMatchOptions |
The old names still work as deprecated aliases. Text strings moved from the feature kind to label (compare with ignoreLabels: false, the default). The @mlightcad/cad-pdf-plugin pdfblock command is removed; use BSEARCH / -BSEARCH instead (after PDF import, turn off layer matching — PDF layers are by color).
AutoCAD groups (GROUP / PICKSTYLE / GROUPDISPLAYMODE)
Starting with the release that includes this change, @mlightcad/cad-simple-viewer registers GROUP, -GROUP, UNGROUP, and GROUPEDIT, expands selection when PICKSTYLE is 1 or 3, and applies GROUPDISPLAYMODE grips for selectable groups. @mlightcad/cad-editor adds CLASSICGROUP (Object Grouping dialog) and a Home → Groups ribbon panel.
Requires @mlightcad/data-model that registers PICKSTYLE (0–3, default 1) and GROUPDISPLAYMODE (0–2, default 2). Associative hatch co-selection (PICKSTYLE 2/3) expands hatch ↔ boundary soft-pointers (DXF 97/330) stored on AcDbHatch.
Associative hatch soft-pointers (DXF 71 / 97 / 330)
Starting with the release that includes this change, @mlightcad/data-model stores per-path source boundary object ids on AcDbHatch (pathSourceIds / setPathSourceIds), round-trips them through DXF groups 71, 97, and 330, and rebuilds hatch loops when a linked boundary is modified (or disassociates when the last source is erased) via AcDbDatabase.hatchAssociationIndex. AcApHatchCmd attaches source ids when creating associative hatches from selected boundaries; pick-points without recoverable sources stay non-associative.
Associative arrays (ARRAY / ARRAYRECT / ARRAYPOLAR / ARRAYPATH / ARRAYEDIT / ARRAYCLOSE)
Starting with the release that includes this change, @mlightcad/data-model adds an ObjectARX-style associative framework under object/assoc/ (AcDbAssocNetwork, AcDbAssocAction, AcDbAssocDependency, AcDbAssocArrayActionBody, rectangular / polar / path parameters). Associative arrays are still drawn as an AcDbBlockReference of an anonymous *U block; the action body owns the parameters and rebuilds item transforms on evaluate.
@mlightcad/cad-simple-viewer registers ARRAY, -ARRAY, ARRAYRECT, ARRAYPOLAR, ARRAYPATH, ARRAYEDIT, and ARRAYCLOSE (alias AR → ARRAY). Defaults: ARRAYASSOCIATIVITY (0 / 1, default 1), ARRAYTYPE (0 rectangular / 1 path / 2 polar, default 0), read-only ARRAYEDITSTATE (0 / 1, default 0; hosts use setArrayEditState). ARRAYCLOSE is registered for AutoCAD parity; until ARRAYEDIT Source mode is implemented it reports that the drawing is not in array edit state. EXPLODE on an associative array yields independent leaf entities and tears down the action graph; array grips adjust column / row / item counts. Creation shows a live preview (not gated by COMMANDPREVIEW). @mlightcad/cad-editor adds a Home → Modify Array dropdown (rectangular / polar / path).
Migrate hosts:
- Bump
@mlightcad/data-model(andlibredwg-converterif you load DWG) together with@mlightcad/cad-simple-viewer/@mlightcad/cad-editor— the viewer callsAcDbAssocManager.evaluateTopLevelNetworkat the end of write commands. - New public APIs include
AcDbAssocArray.createArray/AcDbAssocArrayActionBody.createInstance,acdbAllocateAnonymousUserBlockName,AcDbSysVarManager.setArrayEditState, and curve helpersgetPointAtDist/getFirstDerivonAcDbCurve. - DWG note: LibreDWG may not round-trip assoc objects yet; an array opened from DWG can appear as a plain INSERT without an action body. Prefer DXF for associative-array persistence until DWG import is extended.
cad.view.capturePreview selection preview
Starting with the release that includes this change, CadSession.capturePreview takes an options object instead of a bare longSide number (a bare positive number is still accepted as longSide):
capturePreview?(options?: {
longSide?: number
selection?: boolean
}): Promise<CaptureDrawingPreviewResult>Script callers use cad.view.capturePreview({ longSide?, selection? }). Pass selection: true after cad.selection.replace(ids) to extract the selected entities via the same batch-preview path as ENTPREVIEW (scene bounds, not database geometricExtents) and attach a PNG to the tool result. Empty selection returns reason: 'no-selection'. Headless createDatabaseSession still skips previews (no renderer).
cad.view.capturePreview layer preview
Starting with the release that includes this change, CadCapturePreviewOptions adds layers?: string | string[], and CaptureDrawingPreviewFailure adds 'no-layers':
cad.view.capturePreview({ layers: ['WALL', 'DOOR'], longSide: 1024 })Only model-space geometry on those layers is rendered (an INSERT contributes just its fragments on those layers), framed to the combined extents of the layers instead of the whole drawing. Names are case-insensitive; unknown names throw while the script runs; layers cannot be combined with selection: true. normalizeCadCapturePreviewOptions now returns NormalizedCadCapturePreviewOptions (with layers as a de-duplicated string[]). Custom CadSession.capturePreview implementations should honor options.layers or return reason: 'no-layers'. The viewer implementation uses the new AcApEntityPreviewConvertor.captureLayers(layerNames, longSide).
Lightweight file-open landing entry
Starting with 1.8.0, @mlightcad/cad-simple-viewer exposes a DocManager-free subpath for landing pages. Prefer acuiCreateFileOpenSession (lazy createDocManager + auto open / attachSourcesTo). Use AcUiFileOpenLanding when you open drawings yourself (e.g. Vue MlCadViewer):
import { acuiCreateFileOpenSession } from '@mlightcad/cad-simple-viewer/file-open-panel'Use this on the home / file-picker screen so the full viewer stays lazy until a drawing opens. The Vue editor counterpart is @mlightcad/cad-editor/locale for i18n without mounting MlCadViewer.
Full walkthrough: File Open Panel. Cloud source contracts: Data Source Plugin.
Package renamed: @mlightcad/cad-viewer → @mlightcad/cad-editor
Starting with 1.8.0, the package previously published as @mlightcad/cad-viewer is now @mlightcad/cad-editor, so that its name matches what it actually does.
- The old package is frozen.
@mlightcad/cad-viewerstops at 1.7.x and no release after that will appear on the registry, sopnpm add @mlightcad/cad-viewer@1.8.0fails with a 404. The project is still maintained — just under the new name. - Nothing else changed. Only the package name and the emitted artifact filenames moved; the exports (
MlCadViewer,i18n, …) and their usage are identical. - Rename as part of the same upgrade, so the viewer stays on the same version as the rest of the package set:
{
"dependencies": {
- "@mlightcad/cad-viewer": "1.7.8",
+ "@mlightcad/cad-editor": "1.8.0",
"@mlightcad/cad-simple-viewer": "1.8.0"
}
}- import { MlCadViewer, i18n } from '@mlightcad/cad-viewer'
+ import { MlCadViewer, i18n } from '@mlightcad/cad-editor'If you pin CDN files by version (jsDelivr, unpkg, …), update the filenames as well:
- https://cdn.jsdelivr.net/npm/@mlightcad/cad-viewer@1.7.8/dist/cad-viewer.js
- https://cdn.jsdelivr.net/npm/@mlightcad/cad-viewer@1.7.8/dist/cad-viewer.css
+ https://cdn.jsdelivr.net/npm/@mlightcad/cad-editor@1.8.0/dist/cad-editor.js
+ https://cdn.jsdelivr.net/npm/@mlightcad/cad-editor@1.8.0/dist/cad-editor.cssThe repository name did not change
The GitHub repository is still mlightcad/cad-viewer, and the docs site and live demos keep their existing paths. Only the npm package name changed, so every repository and issue link in this guide still works.
:::
HTML export public API renamed (AcExHtml / acexHtml)
Starting with 1.8.0, the public types and functions of @mlightcad/cad-html-core (re-exported by @mlightcad/cad-html-plugin) use the layer prefixes AcExHtml* (types) and acexHtml* (functions), matching the convention used elsewhere in the monorepo.
Behavior is unchanged; only the symbol names moved. Update imports when you upgrade from 1.7.x:
import {
- type AcExSnapshot,
- buildAcExPackage,
- zipAcExPackageFiles,
- unzipAcExPackageFiles,
- packHtml,
- packHtmlPackage
+ type AcExHtmlSnapshot,
+ acexHtmlBuildPackage,
+ acexHtmlZipPackageFiles,
+ acexHtmlUnzipPackageFiles,
+ acexHtmlPackHtml,
+ acexHtmlPackHtmlPackage
} from '@mlightcad/cad-html-plugin'The same rename applies to other HTML-core helpers (for example captureAcExSavedViewExtents → acexHtmlCaptureSavedViewExtents, buildOsnapCatalog → acexHtmlBuildOsnapCatalog). Command-level APIs such as AcApHtmlConvertor and chtml / -chtml are unaffected. Development guides that show the new names target 1.8.0+; on 1.7.x keep using the old symbols.
Script host: create real dimension entities (drawDim*)
Starting with the release that follows 1.8.0-preview.2, cad.edit.transaction in @mlightcad/cad-script-core can create dimension entities — not only read their snapshots:
drawDimAligned,drawDimLinear,drawDimDiameter,drawDimRadiusdrawDimAngular,drawDimArc,drawDimOrdinate
Agents and scripts should call these instead of approximating dimensions with lines, arrows, and text. Diameter/radius accept center + radius so a circle snapshot can feed them directly. See Script API.
Script host: per-block tallies on cad.blocks
In the release that includes this change, cad.blocks exposes per-block entityCount / typeCounts metadata — no embedded entity arrays. Prefer those fields / count(pred) for tallies. Snapshot with where / inBlock(id, pred) — bare whole-space snapshots stop at ~500 matches (too_many_matches). where / count / inBox scan model and paper spaces only (use inBlock for block definitions). Block references use type === 'BlockReference'.
SVG File → Open
Starting with 1.8.0, .svg can be opened as a drawing through the normal File → Open / openDocument / openUrl path. Vector conversion lives in the new package @mlightcad/cad-svg-converter (depends only on @mlightcad/data-model).
Integrators using @mlightcad/cad-editor: initializeCadViewer registers the converter automatically. Install @mlightcad/cad-svg-converter next to the other fixed-group packages (same version).
Integrators using only @mlightcad/cad-simple-viewer: call once at startup:
import { registerSvgConverter } from '@mlightcad/cad-svg-converter'
registerSvgConverter()Supported subset (v1): line, polyline / polygon / rect, circle, ellipse (polyline approx when non-uniform), path (tessellated), text, nested g + transforms. Export remains csvg in @mlightcad/cad-svg-plugin. Save after editing is still DXF (cdxf) or re-export SVG — there is no native SVG save.
HTML/PDF export skips empty paper layouts by default
Starting with the release that includes this change, HTML and PDF export gain exportEmptyLayouts (default false). Paper-space layouts that contain only AutoCAD's default *Paper_Space viewport are omitted unless you set the option to true. Model space is always kept when layouts are exported.
Migrate: pass exportEmptyLayouts: true (export dialog toggle, -chtml / -cpdf prompt, script cad.file.saveHtml / savePdf, or exporter CLI flags --export-empty-layouts) if you need blank paper tabs in the output.
PDF export split into a shared core (browser + Node)
Starting with 1.8.0, PDF export uses the same layering as HTML export. Shared logic lives in @mlightcad/cad-pdf-core (option model and database → PDF pipeline, no cad-simple-viewer / DOM dependency). Two front ends consume it:
| Package | Role |
|---|---|
@mlightcad/cad-pdf-plugin | Browser cpdf / -cpdf / pdfimport (and the Vue export dialog) |
@mlightcad/cad-pdf-exporter | Headless Node DXF/DWG → PDF — no browser |
Browser integrators — mostly unchanged. Keep using cpdf / -cpdf / pdfimport, AcApPdfConvertor, AcApPdfExportOptions, and resolveAcApPdfExportOptions. Install the new peer @mlightcad/cad-pdf-core next to the plugin (same version as cad-simple-viewer).
User-facing API / behaviour deltas:
- New option
colorMode: 'color' | 'monochrome'(default'color'). Available in thecpdfdialog, as the last-cpdfprompt (Color/Monochrome), and onAcApPdfExportOptions. Existing-cpdfscripts must answer that prompt (or send an empty line for the default) after the text-mode answer. - Headless / CI without a browser: use
@mlightcad/cad-pdf-exporter(exportFileToPdf,convertDatabaseToPdf) instead of drivingcpdfthrough Playwright.
// Browser (names unchanged)
import {
AcApPdfConvertor,
resolveAcApPdfExportOptions
} from '@mlightcad/cad-pdf-plugin'
await new AcApPdfConvertor().convert(
context,
resolveAcApPdfExportOptions({ colorMode: 'monochrome' })
)
// Node, no browser
import { exportFileToPdf } from '@mlightcad/cad-pdf-exporter'
await exportFileToPdf('drawing.dwg', 'drawing.pdf', {
colorMode: 'monochrome'
})Advanced callers that talk to the shared pipeline directly use acexPdfExportDatabase / acexPdfResolveExportOptions from @mlightcad/cad-pdf-core. See the package READMEs for fonts, layouts, and text mode.