Logo
Back

◆ PDF File Creation using MAILLIB

30th September 2010

The MAILLIB library now has the capability to create Adobe PDF files either by streaming source files as email attachments or by creating the files directly on the MCP system. At this time, the implementation is by no means complete and there are various enhancements planned.

With regards to the mail system, PDF attachments can be created from any symbolic or readable stream file. The data is streamed directly in the email content so no local PDF file is created on the MCP system. Instead of using the ^ATTACH directive with, for example, the Opal MAIL function, a PDF variant is available:

              ^ATTPDF *SYMBOL/MYSOURCE ON DEV 

The email attachment file name will be automatically assigned an extension of .PDF to allow the file to opened by the Adobe Reader utility. All PDF files, by default, will open with page thumbnails visible in the Bookmarks navigation panel.

According to file specifications, MAILLIB will attempt to determine the best page formatting and font size to be used. Currently, only the font COURIER NEW is permitted but it will be possible to override this. If necessary, MAILLIB will switch the page set up to Landscape instead of Portrait (e.g. allowing better presentation of 132-character backup files). At this time, only A4 page formatting is supported.

Regarding STREAM files, MAILLIB currently uses a default line width of 90 characters and any lines longer than this are truncated inside the generated PDF file. This temporary behaviour will be corrected in the next release.

The PDF files are uncompressed and not linearized - this means that they are not optimized for fast loading by network or internet access (via a browser). Both linearization and, possibly, compression of PDF files will be available in later releases.

PDF files can also be generated from printer backup files by the MAILLIB; Virtual Server.; At this time, the only way to print files direct to PDF is to set up a new PrintS device:

              PS CONFIG MAILPDF SERVER "PRINTTOPDF IN SL MAILLIB" 

By changing the PRINTDEFAULTS DESTINATION setting of a MCS session or WFL job, all generated backup files will be created with the .PDF extension. Additional controls will be available later allowing the use of PRINTS attributes such as PAGECOMP and FORMID to signal a PDF request.

A new public entrypoint in the MAILLIB library allows PDF files to be created by any external program This entrypoint is shown below:

Booleab Procedure CREATEPDF(INPUT,PDF); 
File INPUT; 
Ebcdic Array PDF[0]; 
  Library MAILLIB; 

The CREATEPDF entrypoint accepts a symbolic blocked file as source and requires the name of the output PDF file from Words[3] onwards in simple DisplayForm name format. There are no security restrictions in force, normal MCP file security applies.

File INPUT(KIND=DISK,TITLE="SYMBOL/MYSOURCE.");
  Ebcdic Array PDF[0:21]; 
  Replace Pointer(PDF[3]) By "PDF/"48"7F""MYSOURCE.PDF"48"7F""."; 
  CREATEPDF(INPUT,PDF); 

At this time, CREATEPDF does not yet handle stream files.