TextDoc

An implementation of the ICpDocument interface which handles plain text based docuemnts.
TextDoc documents can be created from a UTF8 or Ascii encoded text source. and can be output as plain text or native printer graphic command data.
When output as printer command data, some effort will be made to select a suitable printer side code page, and encode the text data to match.
For best results when printing multiple languages, use a UTF8 capable printer and enable UTF8 support through JobConversionOptions.

NameSpace: StarMicronics.CloudPrnt.Documents

Syntax

public class TextDoc : ICpDocument

Constructors

TextDoc(Stream)

Construct a TextDoc object form an input Stream source.
The stream should provide the data as ASCII or UTF8 encodings, without a BOM identifier.
Data will be loaded from the current stream position, until the end of the stream.

Declaration

public TextDoc(Stream input)

Parameters

Type

Name

Description

System.IO.Stream

input

Stream object which the data will be loaded from.

TextDoc(String)

Construct a TextDoc object form an input Stream source.
Source files should be UTF8, or ASCII encoded, without a BOM identifier at the start.

Declaration

public TextDoc(string fileName)

Parameters

Type

Name

Description

System.String

fileName

Name of the input source file.

Properties

JobConversionOptions

Convert the document to the requested format, and write to the specified stream.

Declaration

public ConversionOptions JobConversionOptions { get; set; }

Property Value

Type

Description

ConversionOptions

NativeFormat

Returns the input document format in IANA/MIME media type format, that was used to create this document.
In the case of a TextDoc object, with will always be “text/plain”.

Declaration

public string NativeFormat { get; }

Property Value

Type

Description

System.String

OutputFormats

Provide a list of media types that this document can be converted to.

Declaration

public string[] OutputFormats { get; }

Property Value

Type

Description

System.String[]

Methods

convertTo(String, Stream)

Convert the document to the requested format, and write to the specified stream.

Declaration

public void convertTo(string requestFormat, Stream outStream)

Parameters

Type

Name

Description

System.String

requestFormat

Requires output format, specified as an IANA/MIME format media type. This must be a type that is supported for output by this particular TextDoc object, as listed by the OutputFormats property.

System.IO.Stream

stream

stream that the output data will be written to.