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

RenderHiRes Method (Stream, Product, SurfaceData, RenderingConfig)

Renders a personalized Product to the cache.

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

Syntax

C#
public void RenderHiRes(
	Stream stream,
	Product product,
	SurfaceData data,
	RenderingConfig renderingConfig
)

Parameters

stream

Type: System.IO.Stream

An output Stream.
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.

Remarks

This method renders a product based on a single SurfaceData. When you need a more complex personalization rule, you can use the RenderHiRes(Stream, 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 a file.
var renderer = Injector.Instance.Resolve<IProductRenderer>();
using (var fileStream = File.Create(@"CAPrinting.pdf"))
{
    renderer.RenderHiRes(fileStream, product, surfaceData);
}

See Also

Reference

Manual