NatShare
Search…
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

1
/// <summary>
2
/// Create a print payload.
3
/// </summary>
4
/// <param name="greyscale">Should items be printed in color. Defaults to `true`.</param>
5
/// <param name="landscape">Should items be printed in landscape orientation. Defaults to `false`.</param>
6
PrintPayload (bool color = true, bool landscape = false);
Copied!
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

1
/// <summary>
2
/// Add an image to the payload from a pixel buffer.
3
/// The pixel buffer MUST have an RGBA8888 pixel layout.
4
/// </summary>
5
/// <param name="pixelBuffer">Pixel buffer containing image to add.</param>
6
/// <param name="width">Image width.</param>
7
/// <param name="height">Image height.</param>
8
void AddImage<T> (T[] pixelBuffer, int width, int height) where T : struct;
9
10
/// <summary>
11
/// Add an image to the payload.
12
/// Note that the image MUST be readable.
13
/// </summary>
14
/// <param name="image">Image to add.</param>
15
void AddImage (Texture2D image);
Copied!
Refer to the Adding Images section of the ISharePayload interface for more information.

Adding Image Files

1
/// <summary>
2
/// Add an image file to the payload.
3
/// </summary>
4
/// <param name="path">Path to image file to add.</param>
5
void AddMedia (string uri);
Copied!
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

1
/// <summary>
2
/// Commit the payload and return whether payload was successfully shared.
3
/// </summary>
4
/// <returns>Whether the sharing action was successfully completed.</returns>
5
Task<bool> Commit ();
Copied!
Refer to the Committing the Payload section of the ISharePayload interface for more information.