PrintPayload

class NatSuite.Sharing.PrintPayload

This payload is used to print images using the native printing capabilities.

This payload is currently experimental and is subject to change or removal.

Creating the Payload

/// <summary>
/// Create a print payload.
/// </summary>
/// <param name="greyscale">Should items be printed in color. Defaults to `true`.</param>
/// <param name="landscape">Should items be printed in landscape orientation. Defaults to `false`.</param>
PrintPayload (bool color = true, bool landscape = false);

The print payload can be configured to print in color or greyscale. It can also be configured to print in landscape or portrait orientation.

Adding Images

/// <summary>
/// Add an image to the payload from a pixel buffer.
/// The pixel buffer MUST have an RGBA8888 pixel layout.
/// </summary>
/// <param name="pixelBuffer">Pixel buffer containing image to add.</param>
/// <param name="width">Image width.</param>
/// <param name="height">Image height.</param>
void AddImage<T> (T[] pixelBuffer, int width, int height) where T : struct;
/// <summary>
/// Add an image to the payload.
/// Note that the image MUST be readable.
/// </summary>
/// <param name="image">Image to add.</param>
void AddImage (Texture2D image);

Refer to the Adding Images section of the ISharePayload interface for more information.

Adding Image Files

/// <summary>
/// Add an image file to the payload.
/// </summary>
/// <param name="path">Path to image file to add.</param>
void AddMedia (string uri);

Refer to the Adding Media Files section of the ISharePayload interface for more information.

Only image files (*.jpg, *.png) can be printed. Video files and animated GIF images are not supported.

Printing Images

/// <summary>
/// Commit the payload and return whether payload was successfully shared.
/// </summary>
/// <returns>Whether the sharing action was successfully completed.</returns>
Task<bool> Commit ();

Refer to the Committing the Payload section of the ISharePayload interface for more information.