TrophyCustomer's Canvas is honored with a 2020 InterTech Technology Award! Learn more 

RenderHiRes Method (Product, DataSet, RenderingConfig)

Renders a personalized Product to the cache.

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

Syntax

C#
            IEnumerable<string> RenderHiRes(
	Product product,
	DataSet 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.DataSet

A DataSet providing variable data for the personalization. For more details about this parameter, you can refer to the Rendering Web API topic.
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 DataSet - a collection of personalization rules. When you need a simple personalization rule, you can use the RenderHiRes(Product, SurfaceData, RenderingConfig) method allowing you to specify a SurfaceData.

Examples

You can initialize a DataSet and generate personalized hi-res outputs as follows:
C#
// Specify the personalization data.
var surfaceData = new List<ItemsData> { new ItemsData
{
    RootItems = new ItemDataCollection
    {
        { "Title", new ItemData {Text = "Premium Printing"} },
        { "CompanyLogo", new ItemData {Image = "https://example.com/logo.svg"} }
    }
}};
// Initialize a data set.
var vdpData = new DataSet()
{
    SurfacesData = new SurfaceDataCollection()
};
// Select surfaces and provide personalization data.
vdpData.SurfacesData.Add(new SurfaceData
{
    SurfaceBinding = new SurfaceBinding(0),
    Data = surfaceData
});

// Instantiate IProductRenderer and render the hi-res output.
var renderer = Injector.Instance.Resolve<IProductRenderer>();
var cacheId = renderer.RenderHiRes(product).First();

// Instantiate IFileCache to retrieve the hi-res output.
var fileCache = Injector.Instance.Resolve<IFileCache>();
// Save the hi-res output to a file.
using (var stream = fileCache.GetReadStream(cacheId))
using (var fileStream = File.Create("product.pdf"))
    stream.CopyTo(fileStream);

See Also

Reference

Manual