CONTENT NSSOAP Classes

The CONTENT class contains content data as well as information about the content, such as image type and file name, and how it should be used in a message.

class CONTENT {
  CONTENT_PART part; // The part this CONTENT will play in the message
  CONTENT_TYPE type; // Content image type
  PAGE_STYLE   page_style; // Size of fax pages when sending
  string       name; // Name of content
  byte[]       content_data; // The data to send (unless content_url is set)
  string       content_url; // A URL to send (e.g., http://host/file.html)
}


Members:
part Specifies the part (cover or attachment) that the CONTENT object will play in the message.  Must be set to a member of the CONTENT_PART enumeration.  When set to CoverMessage, the fax server will replace the cover templates $(Cover) field with the text or rich-text (RTF) content you provide (an error will result if you provide any other file format with CoverMessage).

enum CONTENT_PART {
  CoverMessage, // Text or rich-text (RTF) content to use as cover text
  Attachment // Non-cover (attachment) content
}

type Specifies the image type of the content.  Must be set to a member of the CONTENT_TYPE enumeration.  If set to Unknown, the fax server will use the extension on the name to determine the content type.

To fax an HTML file (where you provide the HTML content, not from a Url), set the type to Unknown and specify a name of "*.html".  See name below.

To fax HTML from a Url, see content_url below.

enum CONTENT_TYPE {
  Unknown, // The fax server will determine the file type
  ASCII,
  PCX,
  DCX,
  TIFF
}

page_style Specifies the fax page style.  Must be set to a member of the PAGE_STYLE enumeration.  This setting controls the page length for text files.  For TIF files, a page style of Default should be specified, so that they are faxed according to the length of each TIF image.  Currently, the only way to change the page length of print-captured documents is to change the "Paper Size" in the printing preferences for the "NET SatisFAXtion Document Conversion" printer on the fax server.

enum PAGE_STYLE {
  Default, // Use the fax server default page style
  Letter,
  A4,
  Legal
}

(The page_style field was added in NSSoap version 1.1.)

name

A file name (without a path) that is associated with the content_data field.

Important:  The fax server uses the extension from the name field to locate the application to use for server-based print-capture conversion of the file you provide in content_data.  For example, by providing a name of "MyFile.doc", the fax server will save content_data to a temp file and then use the application associated with .DOC files to print the temp file to the "NET SatisFAXtion Document Conversion" printer, at which time the document will be converted into a faxable image format.

content_data Set this field to a byte array filled with all bytes from the file or string you wish to send.  A byte array can be read from a file, or created from a string like so:

From a file:

  FileStream fs = new FileStream(@"c:\Fax.tif",FileMode.Open);
  content_data = new byte[fs.Length];
  fs.Read(content_data,0,content_data.Length);
  fs.Close();

From a string:

  content_data = System.Text.Encoding.Default.GetBytes("My Text.\r\n");

The content_data field can be null if content is provided using the content_url field.
 

content_url Specifies a URL when faxing an HTML page, otherwise this field can be set to null.  If a content_url is specified, the content_type, name and content_data fields are ignored.  To use the content_url field, initialize the CONTENT object like so:

  CONTENT c = new CONTENT();
  c.part = CONTENT_PART.Attachment;
  c.content_url = "http://www.faxback.com";


Remarks:
The CONTENT class is used to provide content to send_message.

See Also:
send_message, get_message_q, get_message