---
title: "Importing templates | Customer's Canvas On-Premises"
canonical: "https://customerscanvas.com/docs/on-premises/design-atoms-cs/howto/importing-templates/"
---

# Importing templates

> The Design Atoms Framework allows for loading Photoshop and InDesign templates by using the [ITemplateParser](https://customerscanvas.com/docs/on-premises/design-atoms-cs/reference/api/Aurigma.DesignAtoms.Convert/ITemplateParser.md) interface. In the [previous example](https://customerscanvas.com/docs/on-premises/design-atoms-cs/getting-started.md#using-dependency-injection), you have learned how to instantiate this interface through DI.

```csharp
var parser = Injector.Instance.Resolve<ITemplateParser>();
```

Now, let us see how you can:

-   Load a multipage IDML template:

    ```csharp
    var product = parser.FromIdml("invitation.idml");
    ```

-   Load a one-page template:

    ```csharp
    var product = parser.FromFile("postcard.psd");
    ```

-   Load two templates for a two-page product:

    ```csharp
    var product = parser.FromFiles("businesscard_front.psd", "businesscard_back.psd");
    ```    

When you need to load three or more templates, you can pass an array of their file names into the `ITemplateParser.FromFiles` method. You can also create a product based on a surface definition as in the following sample.

## The Sample

This sample illustrates how you can create a two-page product by using the `ITemplateParser.FromDefinition` method. Here, we load the **card.idml** into the first page.

```csharp title="Program.cs"
using System.IO;
using System.Drawing;
using Aurigma.DesignAtoms.Configuration;
using Aurigma.DesignAtoms.Convert;
using Aurigma.DesignAtoms.Rendering;
using Autofac;
using Newtonsoft.Json;

namespace DesignAtomsConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            // Setup dependency injection.
            Injector.CurrentFactory = () => DefaultInjectorFactory.Create();

            // Instantiate TemplateParser.
            var parser = Injector.Instance.Resolve<ITemplateParser>();
            // Create a product based on a surface definition.
            var product = parser.FromDefinition(new[] {
                new SurfaceTemplate
                {
                    // Load an IDML template.
                    DesignFilename = "card.idml"
                },
                new SurfaceTemplate
                {
                    // Create an empty surface.
                    Size = new SizeF(300, 300)
                }
            });

            // Instantiate IProductRenderer.
            var renderer = Injector.Instance.Resolve<IProductRenderer>();
            using (var fileStream = File.Create("card.pdf"))
            {
                // Render the product to a file.
                renderer.RenderHiRes(fileStream, product);
            }
        }
    }
}
```
