How to compare drawing revisions in a web application.
Let users select two drawing revisions from your product, run direct comparison or interactive alignment in Rasterex Canvas, and present completed or failed outcomes in the review workflow your application owns.
Rasterex technical guide
Keep revision selection and review state in your product.
Rasterex exposes a compare API for direct comparison and interactive alignment. Your host application supplies the background and overlay documents, chooses the DPI and output name, and owns the controls, status, permissions and review records.
For a proof of concept, use the Rasterex-hosted sandbox environment. A production deployment and its commercial configuration are established separately when a customer adopts the product.
This guide assumes the Viewer SDK is already installed. Begin with the embedded CAD viewer guide if the lifecycle and installation are not yet in place.
Make revision processing a clear, host-controlled state change.
1. Select revisions
Let the user choose the background and overlay documents from the project or document workflow your application controls.
2. Compare or align
Call direct comparison when the drawings are ready to compare, or start interactive alignment when a user needs to align them first.
3. Resolve terminal state
Clear the local pending state only from comparisonComplete or comparisonError, then show the result or preserve editable inputs after an error.
Start an action; settle on an event.
The documented NPM workflow exposes two terminal events. Keep pending state around the action you start rather than relying on progress events.
Create a comparison-enabled viewer and subscribe to terminal events
01// Create the viewer in the screen that owns the revision workflow.02const viewer = await createViewer({03 container: hostElement,04});05 06const stopComplete = viewer.compare.on("comparisonComplete", (result) => {07 setPending(false);08 setResult(result);09});10 11const stopError = viewer.compare.on("comparisonError", (error) => {12 setPending(false);13 setError(error.message);14});15 16// On screen cleanup:17stopComplete();18stopError();19viewer.destroy();Run direct comparison or interactive alignment
01// Keep the selected documents and output name in host application state.02setPending(true);03setResult(null);04 05await viewer.compare.compare({06 backgroundUrl: inputs.backgroundUrl,07 overlayUrl: inputs.overlayUrl,08 dpi: inputs.dpi,09 outputName: inputs.outputName,10});11 12// For an interactive alignment stage, invoke align with the same inputs:13await viewer.compare.align({14 backgroundUrl: inputs.backgroundUrl,15 overlayUrl: inputs.overlayUrl,16 dpi: inputs.dpi,17 outputName: inputs.outputName,18});Run either compare or align for a user action. The two calls are shown together here to make the documented inputs and their different purposes clear.
Test the complete revision decision, including failure.
- The viewer is ready and both terminal event listeners are registered before a revision action starts.
- Two compatible document URLs, a DPI and an output name are supplied from host application state.
- A direct comparison emits comparisonComplete and makes its result available to the host workflow.
- For interactive alignment, the application supports both the alignment-stage completion and the final generated result.
- An invalid URL emits comparisonError, clears the pending state and leaves the selected inputs editable.
- Event subscriptions and the viewer instance are cleaned up when the screen unmounts.
Revision comparison answers.
What information is needed to compare drawing revisions?
The documented comparison and alignment calls receive a background document URL, overlay document URL, DPI and output name. The host application should let the user select the relevant revisions from its own document workflow.
What is the difference between direct comparison and alignment?
viewer.compare.compare runs direct comparison. viewer.compare.align begins interactive alignment. Both report terminal comparisonComplete or comparisonError events through the Viewer SDK.
When should the revision UI stop showing a pending state?
Keep local pending state around the action the user invokes, then clear it from the documented comparisonComplete or comparisonError terminal events. Do not depend on progress events for the button state.
How should interactive alignment be handled?
For alignment, the first comparisonComplete can represent the interactive alignment stage and the final comparisonComplete returns the generated result. Keep the host workflow ready for both stages.
Put the comparison result into the review workflow that matters.
Decide how the generated result, review decision and revision metadata connect to your existing document and approval records, then test those paths with production-like files.
