Printing Implementation

F9654 R8.08

Printing Processes

The printing system is divided into two independent processes (as described below).

This process writes to the database and the file system. It takes document order items that have been created by the document processor and puts them into print jobs. It also responsible for releasing print jobs. Releasing a print job involves creating the cover sheet (a.k.a. printer instruction sheet), merging the cover sheet with each delivery/envelope PDF, translating the merged PDF to PostScript, and injecting the PostScript media commands into the PostScript document to indicate the paper stock for each page. After a certain configurable number of days, the files related to print jobs that have been transmitted or failed are removed from the file system.

Printer Process

This process writes to the database and physical printers. It takes released print jobs and sends them to a printer. It also sends out the email notifications.

Web.Config

There are some settings in the web.config for printing. These settings can be changed without a code deployment of PASI Core.

Core.PrintConfiguration: This value specifies the name of the configuration to lookup in the print settings file. This setting is specific to each environment.

Core.PrintFrequencyInMinutes: This value specifies the frequency in minutes at which the Print Job Process and the Printer Process will run. This setting is the same across all environments.

Core.PrintJobsEnabled: This value controls whether print jobs will be created, released, and transmitted. If this setting is disabled the entire printing system will be turned off. This setting is specific to each environment.

Core.PrintingEnabled: This value controls whether the system will print to a physical printer or not. This setting is specific to each environment.

Core.MaximumDocumentsPerPrintJob: This value specifies the maximum number of documents/envelopes that can go into a single print job. This should never be set to more than 250.

This file contains locations, destinations, release schedules, configurations and other related settings. This file is embedded in the application and is named printsettings.xml. A change to this file requires a complete code deployment of PASI Core as it is embedded into the application. The reason these settings are outside of the web.config are:

  1. The structure of the data that represents these settings does not fit into a simple key-value pair structure that represents a typical web.config setting
  2. There is a large number of them and to consolidate them together in one place so that all the related settings go out together in a deployment
  3. The settings should not have to be changed very often.
  4. To enable unit testing of the settings to help ensure quality control

Locations

A location is a logical identification for a printer. It has a name and can include a set of email addresses that are tied to that location. Whenever something is sent to a location, the email addresses attached to the location of that printer are included in the email notification.

The following locations are defined:

  • Service Alberta (TEST Manual)
  • Service Alberta (TEST AutomatedMail)
  • Service Alberta (PROD Manual)
  • Service Alberta (PROD AutomatedMail)

Service Alberta has two environments; a test environment and a production environment. All PASI environments except for production use the Service Alberta test environment. The test environment is not connected to any actual printers.

Destinations

A destination has a name and specifies what location to print to based on the delivery method.

The following destinations are defined:

  • Service Alberta (TEST)
  • Service Alberta (PROD)

Release Schedules

A print job will be released as it becomes full. However, at certain times throughout the day print jobs are automatically released. A release schedule is a set of release times and provides a way to release a print job that is not full. There are two release schedules defined.

  • Hourly
  • Courier

The “Hourly” release schedule defines 7:00am, 8:00am etc…as release times. When this means is that a print job that was opened before the most recent release time would automatically get released. For example, if a print job was opened at 6:30am and contained one document in it, it would automatically get released around 7:00am even if there were no other documents that were ready for printing at that time. Production uses the “Courier” release schedule so print jobs are released according to that schedule.

Envelopes

If the delivery method is Automated Mail, the document will be printed at Alberta Treasury Branch and then placed into an envelope by the Pitney Bowes auto-stuffer. An envelope can only contain so many pages based on the weight of the paper and the limitations of the auto stuffer. To relate this restriction to printing, an envelope is defined for a document category and specifies the number of pages that can fit into that envelope. The print settings defines a set of envelopes; one for each document category.

Configurations

A configuration has a name and defines the settings that are applicable for a specific environment. For example, the settings specific to the UAT and Production environments are defined in the “UAT” and “Production” configurations. The web.config Core.PrintConfiguration setting refers to the name of the configuration in the print settings file to use.

Each configuration specifies, among other things, a destination, release schedule, root folder for print jobs, and a set of email addresses. Similar to a location, a configuration has a set of email addresses tied to it. For example, for Production the destination is “Service Alberta”, the release schedule is “Courier” and there is one email address attached to it StudentRecords@gov.ab.ca.

When sending out an email notification, if anything has been sent to a physical printer, the email would go to the location-specific email addresses plus the configuration-specific email addresses. If something has not been physically printed, the email only goes to the configuration-specific email addresses. If something has been sent to a physical printer it means that Core.PrintingEnabled = true and the email is a success email

Envelopes

A print job contains one or more delivery/envelope PDFs. Each delivery/envelope PDF is the digital content of a single envelope. Each envelope has its own sequence number and is mailed to a certain recipient. If more than one copy is ordered for a particular document (i.e. transcript) ideally all those copies would be placed into the same envelope. So the delivery/envelope PDF contains all the copies of the document.

If the delivery method is Automated Mail, the auto stuffer at Alberta Treasury Branch will attempt to stuff the delivery/envelope contents into a single envelope. It is possible that the document, in consideration of the number of copies, may not fit into a single envelope. To handle this the document processor changes the delivery method from Automated Mail to Automated Mail Manual Insert if it determines that the document and all its copies would not fit into a single envelope. If the delivery method is Manual Mail, for example, the bundles go back to Student Records. Student Records then manually stuffs the envelopes and splits the copies into a multiple envelopes as they see fit.

Multiple copies of transcripts and credentials may be ordered. The limit is 10 copies per document order item. If more than one copy of a transcript is ordered, all pages of the document are duplicated. If more than one copy of a credential is ordered, all pages of the document are duplicated except for the first page which is the cover letter. The system produces letters, a user cannot order a letter, so the number of copies for letters is not applicable. The print job process takes into consideration the document category and the number copies when it determines how to duplicate the document and how to apply the overlays. For example, the sequence number and OMR overlays are applied after the document is duplicated whereas the other overlays are applied before.

Paper Selection

There is a requirement to be able to print on different types of paper within a print job. For example, a credential has a introduction letter that is printed on plain paper followed by the actual credential which is printed on credential paper. To support this, as each document is added to a print job, an overlay is added to the upper left corner of each page of the document. The overlay identifies the type of paper it needs to be printed on:

  • T for Transcript
  • C for Credential
  • No overlay needed for plain paper

The PaperSelectionOverlayItem is responsible for adding this overlay where needed. This is applied as a pre-duplication overlay so that the paper selection overlay can be applied properly taking into account the number of copies for the document (if applicable.) For example, if a credential has two copies then the envelope will have three pages; the first page will be the introduction letter and the next two pages identical copies of the credential. When the merged document for the print job is sent for printing, the printer software will automatically mask the paper selection overlay. It will select the right type of paper and not print the actual overlay itself.

File System

Each print job has its own folder. Every file related to a print job is within the folder for that print job. The naming convention is; {PrintJobID} ({OpenedOnUtcTime}) Where PrintJobID is the ID of the print job and the OpenedOnUtcTime is the date/time the print job was opened in the format “yyyy-mm-dd hh-mm-ss”.

For example, the name of the folder for print job ID 1848 that has an opened on UTC time of 2014-Nov-18 9:18:40pm would be “1848 (2014-11-18 21-18-40)” The following is the location of the actual root folder for print jobs in each environment. The security of these folders is inherited from the security of the corresponding parent folder. The PrintJob folder will be created automatically the first time printing is run in PASI Core.

A print job contains one or more delivery/envelope PDF files in the document subfolder. The naming convention is {Sequence}-{NumberOfPages}-{DocumentOrderItemID}.pdf

  • Sequence is the sequence number (left padded with zeros for a total of 5 characters in length)
  • NumberOfPages is the number of pages in the delivery/envelope PDF
  • DocumentOrderItemID is the ID of the document order item

Some examples are:

00001-3-144462.pdf
00002-1-144463.pdf

In addition each file has a corresponding .sha256 (SHA2 using 256 bit) hash file which can be checked using the sha256sum program. For example, assuming the files are not corrupt, the output of 'sha256sum -c *.sha256' for the above two files would be;

00001-3-144462.pdf: OK
00002-1-144463.pdf: OK

A print job also contains other files which are created when a print job is released.

  • The cover sheet is named {PrintJobID}-cover.pdf
  • The merged document is a combination of the cover sheet and each delivery/envelope PDF and is named {PrintJobID}-merge.pdf

Some examples are:

2352-cover.pdf
2352-merge.pdf

The merged document is what is sent for printing. It is sent for printing by copying it over to the appropriate hot folder. Similar to the delivery/envelope PDF files, the above files have a corresponding .sha256 hash file which can be checked using sha256sum –c *.sha256 There is also a log file which contains some details about how the files were created.

Manually Re-sending a Print Job

If a print job has failed and is not retrying anymore or if a print job has been sent but needs to be re-sent, you can manually send the print job to Service Alberta. To manually send or resend a print job you need to know where the print job file is and what hot folder to copy the print job file to. The email that PASI sent out has both pieces of information.

Environment: Local Development
Job Number: 12827
Account: 543590-01-8243-50027-00045

Creation Date: 29-JAN-2020
Printer: \\edm-goa-prt-34\hf\PASI_AUTO_HF
Transmitted on: 29-JAN-2020
C:\Temp\PrepRoot\PrintJob\12827 (2020-01-29 23-08-15)\12827-merge.pdf
Document Type: Transcript
Start Sequence Number: 1
End Sequence Number: 5
Number of Pages: 15

In the above email example, the print job file is 12827-merge.pdf and the hot folder is: \\edm-goa-prt-34\hf\PASI_AUTO_HF (UAT). To send or re-send it to Service Alberta, copy the 12827-merge.pdf file to the \\edm-goa-prt-34\hf\PASI_AUTO_HF hot folder.

Note: Production folder is: \\edm-goa-prt-36\HF\PASI_MANU_HF