---
title: "Loading Templates"
canonical: https://customerscanvas.com/docs/cc6/loading-templates-in-daf.htm
archived: true
applies_to:
  - product: "Customer's Canvas On-Premises"
  - product: "Design Atoms .NET"
    versions: ["6.15.0", "6.x (may differ)"]
---

**You’re viewing outdated documentation.** [View the latest Customer’s Canvas On-Premises documentation](https://customerscanvas.com/docs/on-premises/).

# Loading Templates

**Applies to:** Customer's Canvas On-Premises; Design Atoms .NET 6.15.0, 6.x (may differ) · **Archived documentation**
 
The Design Atoms Framework allows for loading Photoshop and InDesign templates. The [Creating Product Templates](https://customerscanvas.com/docs/cc6/creating-product-templates.htm.md) section describes the supported features and demonstrates how you can create your templates. To load these templates, you can use the [ITemplateParser](https://customerscanvas.com/docs/cc6/T_Aurigma_DesignAtoms_Convert_ITemplateParser.htm.md) interface. In the previous example, you learned how to instantiate this interface through DI.
 
```
var parser = Injector.Instance.Resolve<ITemplateParser>();
```
 
Now, let us see how you can:
 
- Load a multipage IDML template: 
```
    var product = parser.FromIdml("invitation.idml");
    ```
- Load a one-page template: 
```
    var product = parser.FromFile("postcard.psd");
    ```
- Load two templates for a two-page product: 
```
    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 [FromFiles(String\[\])](https://customerscanvas.com/docs/cc6/M_Aurigma_DesignAtoms_Convert_ITemplateParser_FromFiles_1_c998fbdd.htm.md) 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 [FromDefinition(SurfaceTemplate\[\])](https://customerscanvas.com/docs/cc6/M_Aurigma_DesignAtoms_Convert_ITemplateParser_FromDefinition_1_5805fa49.htm.md) method. Here, we load the `card.idml` into the first page.
 
```
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);
            }
        }
    }
}
```
 
## See Also
  
### Manual
 
- [Design Atoms Framework Overview](https://customerscanvas.com/docs/cc6/design-atoms-fw.htm.md)
- [Creating Applications with Design Atoms Framework](https://customerscanvas.com/docs/cc6/deploying-design-atoms.htm.md)
- [Using Dependency Injection](https://customerscanvas.com/docs/cc6/using-dependency-injection.htm.md)

### Reference
 
- [ITemplateParser Class](https://customerscanvas.com/docs/cc6/T_Aurigma_DesignAtoms_Convert_ITemplateParser.htm.md)

### Other
 
- [Design Atoms sample project↗](https://github.com/aurigma/DesignAtomsSamples)
