Design Atoms .NET
This section covers the backend libraries. For the frontend, see Design Atoms JS.
Design Atoms .NET allows for manipulating individual elements of a design edited in the web-to-print editor. If you think of the Design Editor as a browser, you may consider Design Atoms as a DOM API. For example, you may import a template, then use Design Atoms to iterate all items, then find, for example, a text element named City, and change its value. You can also create a brand new design and pass it to Design Editor.
Design Atoms .NET libraries
If you are developing your backend application for .NET, you can also use Design Atoms to create your own service layer to work with designs.
Design Atoms .NET consists of two important parts, which you can install as NuGet packages:
Aurigma.DesignAtoms.Model- the object model describing designs.Aurigma.DesignAtoms- all necessary controllers for drawing objects, obtaining the necessary data, and rendering the object model.
What you can do with this API:
- Create a design from scratch or generate it with certain rules
- Manipulate elements through code
- Import designs from various source formats
- Render print files or proof images on your server
- Create completely custom editors
Modules of Design Atoms
Design Atoms is split into two libraries: Design Atoms .NET and Design Atoms JS.
- The frontend component visualizes an object model and provides a graphical user interface for manipulating objects.
- The backend component provides all necessary controllers for drawing objects, obtaining the necessary data, and rendering the entire object model. This module also contains controllers for converting Photoshop and InDesign templates into the Design Atoms object model.
- The object model implements design elements for print products on both the frontend and backend.
Design Atoms provides the client-side and server-side code for serialization and deserialization of the object model in the JSON format. For example, you can serialize your object model on the client side and pass it to the server within an HTTP request.
You can also save products to state files for long-term storage. For example, you can transfer these files to another computer for editing and rendering print-ready files. In Design Atoms terms, a product is a state file loaded into Design Editor.
You can start working with the object model as soon as you import the frontend modules. However, to use the full functionality of Design Atoms, you need to connect your frontend code with a backend. There are two ways to get the backend—create your own backend or hook it to an existing Design Editor instance.
A custom backend is a good option when you don't need an editor but rather need to manipulate designs through the JavaScript/TypeScript or C# code and render the result in your application. Also, it is the way to go if you want to create a custom editor based on the Viewer control. Another purpose is to handle the rendered output in a separate application.
As an example, you can download a sample project illustrating how you can use Design Atoms.
Design Atoms .NET object model
The frontend and backend share the same object model. On the backend, the model is implemented in the Aurigma.DesignAtoms.Model namespace. Here, you can find:
- Classes of the object model that represents the following entities of printed documents:
- Product - a print product that contains surfaces (pages).
- Surface - a page that contains print areas, mockups, and containers with design elements.
- Print area - an area of a design to be printed.
- Mockup - background and overlaying mockups that help visualize designs.
- Container - a collection of design elements or mockups.
- Design elements - images, text, shapes, barcodes, and more.
- Safety lines, watermarks.
- Auxiliary classes like Point, Path, FontSettings, etc.
In this model, each surface may have several item containers. There are three default containers for the background, main area, and foreground. These containers allow you to display several designs on top of each other in a viewer.
Design Atoms .NET backend
The backend component is responsible for:
- Generating preview images and hi-res outputs.
- Importing the object model from product templates (PSD and IDML files).
- Creating a set of designs of different sizes programmatically.
- Manipulating design elements according to custom logic.
If an existing Design Editor instance does not fit your needs, you can implement your custom backend in either a Web, desktop, or console application. In this way, you can develop your backend API for the viewer or develop custom methods to preview and generate high-resolution outputs.
The backend component consists of the following NuGet packages:
Aurigma.DesignAtomscontains controllers for drawing objects, obtaining the necessary data, and rendering the entire object model.Aurigma.DesignAtoms.Modelimplements the object model.
To install the backend, you can run the following command in the Visual Studio Package Manager Console:
Install-Package Aurigma.DesignAtoms
After installation, you can start working with the object model. For example, you can create a product from scratch as follows:
using Aurigma.DesignAtoms.Model;
var product = new Product {
Surfaces = { new Surface(400, 400) }
};
When you need a backend for processing data from a browser, then create a Web application, add a reference to Aurigma.DesignAtoms, and expose the necessary endpoints. The viewer component requires the ViewerController on the backend. You can initialize this controller and connect your frontend with a backend as follows:
const backendUrl = "http://<instance_url>";
const holder = document.querySelector("#viewer-container") as HTMLDivElement;
const viewer = new Viewer({
holderElement: holder,
backendUrl: backendUrl,
canvasBackground: { color: "white" }
});