Applies To:
  • CitectSCADA 5.xx, 6.XX, 7.00
  • CitectHMI 5.xx, 6.XX, 7.00

Summary:
I want to be able to print reports that contain JPG/BMP/ images in the format file, such as a company logo.
When I set up the report to print to a PRINTER device, the images are omitted.
 

Solution:
Firstly, there is a limitation on the size of a Report Format File, please ensure your image is as small a file size as possible. Images as small as 20kb have been known to cause errors. If the picture is too large a compilation error is generated, "Cicode Function greater than 64K".

In order to obtain this functionality, you will need to setup the device to log to an ASCII device, and save the report to a .RTF file.
For the below example we are assuming that the file is 'c:\testreport.rtf'.

Once the RTF file has been saved with its picture, Microsoft WordPad can be used to open the file and print it to the default printer. The EXEC Cicode function can be used to automate this process and by using Mode 6 the instance of WordPad will remain hidden from view.

EXAMPLE:

Firstly, the format file will need to be modified. The following Cicode will allow the Report to call the Cicode function 'PrintReport', which is detailed later in this example.

{CICODE}
Tasknew("PrintReport",0);
{END}

The reason TaskNew is used, is to allow the report to complete before the file is printed, otherwise the file will not exist, or there could be some file-access conflicts.

Create a Cicode Function called 'PrintReport' (the name above or as you modified it ) containing the following cicode:

FUNCTION PrintReport()
    Sleep(1);
    Exec("c:\Program Files\Windows NT\Accessories\Wordpad.exe /p c:\testreport.rtf",6);
END

Please ensure that the file paths in the example are modified to suit your application, and the PC they will be run on.

Every time the report is now run, it will save the report to a file, and then print that file.

 

Keywords:
Pictures pic picture jpg bmp report print printing  

Attachments