You’re viewing outdated documentation. View the latest Customer’s Canvas On-Premises documentation.

RenderHiRes Method (Product, SurfaceData, RenderingConfig)

Applies to: Customer's Canvas On-Premises; Design Atoms .NET 6.0.0, 6.x (may differ) · Archived documentation

Renders a personalized Product to the cache.

Namespace: Aurigma.DesignAtoms.Rendering
Assembly: Aurigma.DesignAtoms (in Aurigma.DesignAtoms.dll)

Syntax

C#
public IEnumerable<string> RenderHiRes(
	Product product,
	SurfaceData data,
	RenderingConfig renderingConfig
)

Parameters

product

Type: Aurigma.DesignAtoms.Model.Product

A Product used as a template to create personalized copies.
data

Type: Aurigma.DesignAtoms.Model.SurfaceData

A SurfaceData providing variable data and selecting surfaces for the personalization.
renderingConfig

Type: Aurigma.DesignAtoms.Configuration.RenderingConfig.RenderingConfig

Rendering properties. When you skip this parameter or pass null, the dafault configuration is applied.

Return Value

A collection of image IDs in the cache.

Remarks

This method renders a product based on a single SurfaceData. When you need a more complex personalization rule, you can use the RenderHiRes(Product, DataSet, RenderingConfig) method allowing you to specify a collection of SurfaceData.

Examples

You can initialize a SurfaceData and generate personalized hi-res outputs as follows:
C#
// Define personalization data.
var surfaceData = new SurfaceData()
{
    // Render the third page only.
    SurfaceBinding = new SurfaceBinding(2),
    Data = new List<ItemsData> { new ItemsData
    {
        // Replace the Company and Logo fields.
        RootItems = new ItemDataCollection
        {
            {"Company", new ItemData {Text = "CA Printing"}},
            {"Logo", new ItemData {Image = "https://example.com/images/logo.svg"}}
        }
    }}
};

// Render the page to the file cache.
var renderer = Injector.Instance.Resolve<IProductRenderer>();
var cacheID = renderer.RenderHiRes(product, surfaceData).First();

// Save the pages to a file.
var fileCache = Injector.Instance.Resolve<IFileCache>();
using (var stream = fileCache.GetReadStream(cacheID))
using (var fileStream = File.Create($"{cacheID}"))
    stream.CopyTo(fileStream);

See Also

Reference

Manual