---
title: clsPrint
summary: API reference for clsPrint.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-07-24
library: SAIF.Services.Printing
reference_type: package
---

# clsPrint

`clsPrint` is the library's xPression integration class. It stores request state, resolves environment-dependent configuration, and exposes operations for previewing, printing, publishing, and distributing documents.

## Purpose
- Manage xPression-oriented report transport settings and call the generated SOAP client.
- Support both direct service distribution and transactional MSMQ-backed asynchronous distribution.

## Context
- Namespace: `SAIF.Services.Printing`
- Assembly/package: `SAIF.Services.Printing`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `IDMEnvs` | `Public Enum IDMEnvs` | Enumerates IDM environment labels defined by the class. See [IDMEnvs](IDMEnvs.md). |
| `Application` | `Public Property Application() As String` | Gets or sets the application label passed to xPression service calls. |
| `Asynchronous` | `Public Property Asynchronous() As Boolean` | Gets or sets whether distribution uses the MSMQ path instead of the direct SOAP path. |
| `Copies` | `Public Property Copies() As Int16` | Gets or sets the requested print copy count. |
| `Environment` | `Public ReadOnly Property Environment() As String` | Returns the environment label set by the constructor (`Prod` or `Dev`). |
| `Format` | `Public Property Format() As String` | Gets or sets the distribution output format. |
| `ImportInfo` | `Public Property ImportInfo() As clsImageImport` | Gets or sets imaging metadata included in distribution requests. |
| `OutputProfile` | `Public Property OutputProfile() As String` | Gets or sets the xPression output profile name. |
| `Package` | `Public Property Package() As String` | Gets or sets the xPression package name, trimming a trailing `.pkg` suffix when supplied. |
| `PlexMode` | `Public Property PlexMode() As PlexMode` | Gets or sets the xPression duplex or simplex print mode. |
| `Printer` | `Public Property Printer() As String` | Gets or sets the target printer name. |
| `ScaleMode` | `Public Property ScaleMode() As ScaleMode` | Gets or sets the xPression scale mode. |
| `XML` | `Public Property XML() As String` | Gets or sets the current XML payload. |
| `FaxInfo` | `Public Property FaxInfo() As FaxInfoClass` | Gets or sets fax delivery metadata, instantiating a default object on first access. |
| `EmailInfo` | `Public Property EmailInfo() As EmailInfoClass` | Gets or sets email delivery metadata, instantiating a default object on first access. |
| `DeferredInfo` | `Public Property DeferredInfo() As DeferredPrintInfoClass` | Gets or sets deferred-delivery metadata, instantiating a default object on first access. |
| `IDMPath` | `Public ReadOnly Property IDMPath() As String` | Returns the IDM path resolved from `EnvironmentServiceBase`. |
| `CompositeRequestClass` | `Public Class CompositeRequestClass` | Serializable nested type used as the MSMQ payload for asynchronous distribution. See [CompositeRequestClass](CompositeRequestClass.md). |
| `New` | `Public Sub New()` | Creates an instance using `AppGlobal.EnvironmentService`. |
| `New` | `Public Sub New(envSvc As EnvironmentServiceBase)` | Creates an instance using the supplied environment service and initializes the xPression proxy URL and queue path. |
| `previewPDF` | `Public Function previewPDF(inPackage As String, inXML As String) As Byte()` | Previews a PDF through the xPression `previewPDF` operation. |
| `previewDocument` | `Public Function previewDocument(inPackage As String, inXML As String) As Byte()` | Previews a document using the current output profile. |
| `previewDocument` | `Public Function previewDocument(inPackage As String, inXML As String, inOutputProfile As String) As Byte()` | Previews a document using a supplied output profile. |
| `printPDF` | `Public Function printPDF(inFile As Byte()) As Boolean` | Sends a rendered PDF byte array to the xPression `printPDF` operation. |
| `distributeDocument` | `Public Function distributeDocument(inPackage As String, inXML As String) As Boolean` | Distributes a document either directly or through MSMQ, based on `Asynchronous`. |
| `StartMQTransaction` | `Public Sub StartMQTransaction()` | Starts a reusable `MessageQueueTransaction` for asynchronous distribution. |
| `EndMQTransaction` | `Public Sub EndMQTransaction(inAction As Boolean)` | Commits or aborts the active `MessageQueueTransaction` and clears local state. |
| `xpublishDocument` | `Public Function xpublishDocument(ByRef inDocumentName As String, ByRef inOutputProfile As String, ByRef inXML As String, ByRef inApplication As String) As String` | Publishes a document through the generated xPression proxy. |
| `xpreviewHTML` | `Public Function xpreviewHTML(ByRef inDocumentName As String, ByRef inOutputProfile As String, ByRef inXML As String, ByRef inApplication As String) As Byte()` | Requests an HTML preview from xPression. |
| `xpublishAndReturnDocument` | `Public Function xpublishAndReturnDocument(ByRef inDocumentName As String, ByRef inOutputProfile As String, ByRef inXML As String, ByRef inApplication As String) As Byte()` | Publishes a document and returns its bytes from xPression. |
| `xdocumentsForCategory` | `Public Function xdocumentsForCategory(ByRef inDocumentCategory As String, ByRef inApplication As String) As String()` | Lists xPression documents for a category. |
| `xoutputProfilesForDocument` | `Public Function xoutputProfilesForDocument(ByRef inDocumentName As String, ByRef inApplication As String) As String()` | Lists output profiles for a document. |
| `xcategoriesForUser` | `Public Function xcategoriesForUser(ByRef inApplication As String) As String()` | Lists xPression categories visible to the current application or user context. |

## Behavioral notes
- `Package` strips a trailing `.pkg` suffix before storing the package name.
- `distributeDocument` follows [BR-001](../../business-rules.md#br-001-distribution-mode-follows-the-asynchronous-flag) and [BR-002](../../business-rules.md#br-002-asynchronous-distribution-must-commit-or-abort-an-msmq-transaction) when choosing and managing its distribution path.
- The synchronous distribution path passes `PaperTray.Tray2` to the generated xPression proxy.

## Constraints and usage notes
- Successful construction depends on runtime availability of `documentGeneratorServiceUrl` and `documentMSMQPath`.
- Callers must populate `Package`, `XML`, and any delivery metadata needed for the selected operation before invoking preview, print, or distribution methods.
- `IDMPath` is resolved lazily from `EnvironmentServiceBase` each time the property is read.

## Sources
- `Services\SAIF.Services.Printing\clsPrint.vb`
