Chapter 6 - How to merge logos and other background image files

PRINTFIL can include logos and other graphical images to your print jobs. This feature is particularly useful to obtain jobs on "Letterheads" or on standard forms ("Invoices", "Order modules" etc.)

This files can be previously created using any graphical editor, (Paint Shop Pro, CorelDraw etc.), then you can include them in your print jobs in several ways.

The easiest for end users is just by selecting the desired background image at Configuration -> Standard -> Options and Printfil will merge that image on all pages of the captured print jobs, full page size. If you just want to merge a small logo you can create a white image, as big as the sheet, and place your small logo everywhere on that space.

Article and Video: Merge images to DOS print jobs instead of printing on preprinted forms

If you're an experienced user, or a programmer, there are 2 additional, much powerful, methods:

  1. Using the 4th line in FILENAME.CFG (see Chapter 3).
  2. Using special Control Codes inside your ascii print-job file (see Chapter 5).

In both cases you have to specify at least the name of the graphics background file to load.

You can use files: WMF (Windows Meta Files), EMF (Enhanced Meta Files), BMP (Bitmap), PDF (Portable Document Format), JPG (Joint Photographic Experts Group), GIF (Graphics Interchange Format) and PNG (Portable Network Graphics).

If the extension is not specified, WMF will be assumed.

If the path is not specified, PRINTFIL will use the path of the ASCII print-job file (see the FileName setting of PRINTFIL.INI). In this way, a UNIX or LINUX application can create the file (for example) /usr/share/printfil/filexx.txt and write only "filexx.bmp" as background image. PRINTFIL on a Windows PC will search both files in the same directory (for example F:\PRINTFIL\FILEXX.*).

If the specified background file is not found, or the Windows user running Printfil doesn't have read permission on it, no background will be included.

Each kind of file has its own peculiarities:

  • WMF and EMF files were most used on the oldest Windows. They're very light, ma not so versatile because they can only be merge to the entire page. If you want just a small logo on top of the page you need to create a file as large as the sheet, with all the remaining white space.
  • BMP files usually are rather big (in Mb), but their dimension is greatly reduced if they're saved with RLE compression. They're fast to load and versatile.
  • PDF files are widely used, sufficiently compact and as versatile as BMP files, but they need high hardware resources to be included in the textual print jobs (from 10Mb to 50Mb RAM per page, depending by how complex is the PDF itself) and it's also needed installing GhostScript on the PC (please see chapter 9.1).
    In addition, if the PDF includes multiple pages, only the first one will be included.
  • JPG, GIF and PNG files are widely used too, because they're rather small, but they needs to be decompressed in memory to be merged in the print jobs and could slow down the printing process on systems with limited hardware resources.
So, on sistems with limited hardware resources, we suggest converting background files into BMP's with RLE compression by using a graphical editor (like "Paint Shop Pro" or "Coreldraw") and include the BMP's instead.

As we said above, while WMF and EMF files will be enlarged to fit the entire page, the other files will normally be enlarged to "printable" dimensions (i.e. entire page minus the margins previously set). In addition, only the other files can be placed anywhere on the sheet by providing parameters after the file name separated by "pipe" ("|" , ascii 124) , according with the following syntax:

FileName | Top | Left | Width | Height | FromPage | ToPage

The first 4 additional parameters will be in the same units-of-measure set for the page margins.

Top and Left are for placing the Top-Left corner of the Bitmap. If they are positive, the margins (are set in the configuration dialog) will be considered, else (if they are negative) the bitmap will be placed taking care only of the sheet's dimensions.

For example, if you set the first two parameters to 2.5 | 1.2 and the margins are set to 0.5 Cm. on each side of the sheet, the bitmap will be placed at 3 Cm. from the top margin of the sheet and 1.7 Cm. from the left margin, while if they are set to -2.5 | -1.2 , the bitmap will be placed at 2.5 Cm. from the top margin of the sheet and 1.2 Cm. from the left one, independently by the margins set in the configuration dialog.

The first case is useful, for example, to ensure an invoice will be always printed inside the "cells", because either the text or the bitmap will be redimensioned taking care of the margins. The second case can be useful to place a bitmap outside the margins: for example to add a logo at the top of a page which normally would be entirely filled with the text, without changing the source application.

Width and Height have a little more sophisticated behavior:

  1. If the value is positive, the bitmap will have that dimension.
  2. If the value is zero, the bitmap will be expanded to the margins of the sheet.
  3. If the value is -1, the dimension will be automatically calculated to maintain the original proportions. For example, if the bitmap is square and you set its height to 7 and its length to -1, the resulting length will be 7 also.
  4. Every value under -1 will have the effect of using the original dimensions of the bitmap in pixels. WARNING: use this technique with care because in using it, the resulting dimensions (in Cm. or In.) on the sheet will depend on the printer resolution set in the Windows driver.

FromPage and ToPage tells Printfil on which page(s) the bitmap has to be printed. They can be set to the same value (for example 1|1 = only the first page on the print job). If they are not set (or they are set to zero), the bitmap will be placed on all the pages.

Please note that the CFG file is read BEFORE the print job starts while Escape Sequences are interpreted DURING the print job creation. The page parameters in the 2nd case can be used to tell Printfil IF the bitmap should be merged in THIS page or not, without having the source program making the necessary calculations itself.

For example, the source program could place "One.bmp|||||1|1|Two.pdf|||||2|2|Three.jpg|||||3|3" on top of each page, and Printfil will merge just one (the right one) bitmap per page.

The entire sequence can be repeated different times on the same row to specify different background bitmaps which can be printed on different pages and positions.



Sets only the name of the BMP file. The bitmap will be expanded to fit the entire "printable" sheet.
The bitmap will be placed 2 Cm. from the top margin of the sheet and 2 from the left margin (plus the margins) and will be expanded to the remaining area on the sheet.
The bitmap will be placed as above, will be enlarged to the right margin of the sheet, and the height will be calculated to maintain the original proportions.
The bitmap will be placed at the top-left corner, its height will be 5 Cm. and it will be as wide as necessary to maintain the original proportions.
The bitmap will be placed 7 Cm. from the top margin, 3 Cm. from the left margin and will be printed AS IS.
The bitmap will be placed 2 Cm. from the top margin of the sheet and 2 from the left margin (independently by the margins set into the Printfil's configuration dialog) and will be expanded to the remaining printable area on the sheet.
Allows you to place 2 bitmaps on every page (the first one on pages from 1 to 999999 and the second one from 0 to 0, which is the same thing).
Allows you to place faxcover.pdf only on the 1st page (enlarged to the margins) and invoice.bmp on all the other pages.
Invoice.bmp will be placed on all the pages, but shifted 3 Cm. up starting from the 2nd page.

Article and Video: From printing DOS invoices on carbon copy paper to multipage PDFs

Print from DOS to USB printer now! Download free PrintFil trial!