Skip to content

DocumentService

Implements IDocumentService, acting as the client-side facade over the DocGenerator web service (via DocumentServiceProxy) that generates, previews, and distributes (print/email/fax/image-import) PDF and Word documents from packaged templates. It is constructed with IEnvironmentService (to resolve the documentGeneratorServiceUrl and idmfilepath config settings) and pass-through IEmailService, IImagingService, IPrintService, and IFaxService collaborators that are exposed as public properties for callers building distribution requests.

Purpose

  • Lists the DocGenerator categories and packages available for document generation.
  • Generates a PDF (or other document type) preview from a named package and XML payload.
  • Distributes a generated document via print, email, fax, imaging import, or a document-center deferred workflow, with several overloads for different combinations of print/mail/fax configuration.
  • Exposes the injected email, imaging, print, and fax service collaborators for callers that need them directly.

Context

  • Namespace: SAIF.Services.Utilities.Documents
  • Assembly/package: SAIF.Services (packaged inside the SAIF.SAIFCode.Core NuGet package)

Public members

Member Signature Purpose
EmailService public IEmailService EmailService { get; private set; } The injected email-sending collaborator, exposed for direct use by callers.
ImagingService public IImagingService ImagingService { get; private set; } The injected imaging collaborator, exposed for direct use by callers.
PrintService public IPrintService PrintService { get; private set; } The injected print collaborator, exposed for direct use by callers.
FaxService public IFaxService FaxService { get; private set; } The injected fax collaborator, exposed for direct use by callers.
DocumentService(...) public DocumentService(IEnvironmentService environmentService, IEmailService emailService, IImagingService imagingService, IPrintService printService, IFaxService faxService) Builds the DocGenerator proxy from the documentGeneratorServiceUrl config setting, captures the idmfilepath auto-import path, and stores the injected email/imaging/print/fax collaborators.
GetCategories public string[] GetCategories() Returns the list of document package categories known to the DocGenerator service.
GetPackages public string[] GetPackages(string category) Returns the document package names available under category.
GeneratePdf public byte[] GeneratePdf(string packageName, string packageXml) Generates a PDF-format preview of packageName populated with packageXml and returns the raw bytes.
GenerateDocument public byte[] GenerateDocument(DocumentGenerationConfig config) Generates a preview document per config (package, XML, and output profile) and returns the raw bytes.
DistributeDocument(docConfig, imageConfig) public void DistributeDocument(DocumentGenerationConfig docConfig, ImageConfig imageConfig) Distributes the document to imaging import only, using simplex/no-scale/tray-2 defaults and the configured auto-import path.
DistributeDocument(docConfig, imageConfig, mailMessage) public void DistributeDocument(DocumentGenerationConfig docConfig, ImageConfig imageConfig, MailMessage mailMessage) Distributes the document to imaging import and emails it via mailMessage, using simplex/no-scale/tray-2 print defaults.
DistributeDocument(docConfig, imageConfig, printConfig) public void DistributeDocument(DocumentGenerationConfig docConfig, ImageConfig imageConfig, PrintConfig printConfig) Distributes the document to imaging import and to the printer/settings described by printConfig.
DistributeDocument(docConfig, imageConfig, mailMessage, printConfig) public void DistributeDocument(DocumentGenerationConfig docConfig, ImageConfig imageConfig, MailMessage mailMessage, PrintConfig printConfig) Distributes the document to imaging import, email, and the printer/settings described by printConfig.
DistributeDocument(docConfig, imageImportSettings, mailMessage, faxInfo, printConfig, deferredPrintConfig) public void DistributeDocument(DocumentGenerationConfig docConfig, string imageImportSettings, MailMessage mailMessage, FaxInfoClass faxInfo, PrintConfig printConfig, DeferredPrintConfig deferredPrintConfig) Routes the document through the Doc Center distribution path, combining imaging import, email, fax, print, and deferred-print handling in one call.
Dispose() public void Dispose() Disposes the underlying DocGenerator proxy connection and suppresses finalization.

Behavioral notes

  • All distribution overloads ultimately delegate to DocumentServiceProxy.DistributeDocument/DistributeDocumentDocCenter, always passing the constructor-resolved autoImportPath as the imaging import path.
  • The simpler overloads hard-code PlexMode.Simplex, ScaleMode.None, and PaperTray.Tray2 rather than exposing them, so callers needing different print settings must use the PrintConfig-accepting overloads.

Sources

  • Services/SAIF.Services/Utilities/Documents/DocumentService.cs