Displays a TIF image on multiple pages in Reports 10G.

Notice that it can be any object (field, frame, image JPG, BMP, etc.), we are not treating here multi-page tiff!!Important! This document is NOT about "Multi page TIF" which is in fact a file that contains several images. Multi-page : TIFF defines support for multiple images in a single file. Such a file is then called 'multi-page' TIFF. Thus, the TIFF format is very well suited to e.g. store the many pages of a single fax in a single file. "Multi page TIF" is not supported in Reports, i.e. Oracle Reports does not have this feature implemented !The document first describes how to insert a TIF (or JPG, or BMP) image in the DB as a BLOB using a procedure and then how to implement the report:
SolutionThe following steps should be followed:
1. Check the write rights in utl_file_dir.
SQL> conn /as sysdba Connected. SQL> show parameter utl_file_dir
NAME TYPE VALUE
------------------------------------ ----------- ----------------------------- --------------------- utl_file_dir string /u01/app/oracle/product/10.1. 0/Db_1/demo/schema/log
If it is * it means that the DIR can point anywhere.

2. Use a table named images.
desc images; Name Null? Type
----------------------------------------- -------- ----------------------------
IMAGE_NAME NOT NULL VARCHAR2(30) CONTENT_IMG BLOB

3. Create the virtual directory to the utl_file_dir value.CREATE OR REPLACE DIRECTORY TESTTIFF AS '/u01/app/oracle/product/10.1.0/Db_1/demo/schema/log';

4. Create and execute the following procedure that inserts the TIF into the DB.
create or replace PROCEDURE INSERT_TIF AS v_filename varchar2(16); p_file_loc varchar2(100); v_file bfile; v_file_blob blob; begin v_filename:='010021004160.tif'; -- name of the file (the file must be copied into the already defined oracle directory) p_file_loc:='TESTTIFF'; -- name of the oracle directory where the image file is located v_file:=bfilename(p_file_loc,v_filename);
INSERT INTO images values(v_filename,empty_blob() ) RETURN content_img INTO v_file_blob;
dbms_output.put_line('file size 'v_filename' is : 'dbms_lob.GETLENGTH(v_file)' Kb'); dbms_lob.fileopen(v_file, dbms_lob.file_readonly); dbms_lob.loadfromfile( v_file_blob, v_file, dbms_lob.getlength(v_file) ); dbms_lob.fileclose(v_file); commit; exception when others then dbms_output.put_line(sqlerrm); end;

5. Verify that the TIF was correctly inserted into the DB.
SQL> select image_name,dbms_lob.GETLENGTH(content_img) from images;
IMAGE_NAME DBMS_LOB.GETLENGTH(CONTENT_IMG)
------------------------------ -------------------------------
010021004160.tif 528120

6. Create a test report in Reports Builder 10g release 2 (10.1.2.0.2) to display the TIF as a BLOB image.
6.a. In the Main Section, press F4 for the Property Palette and set the "Horizontal Panels per Page" to 2 and "Vertical Panels" per Page 2, for example.
6.b. Afterwards, in the Paper Layout, zoom out to see all the panels and expand the BLOB field by dragging its margins in order to expand over the 4 panels.
Note!!! The field containing the BLOB must have "Fixed" Vertical Elasticity, otherwise the picture will shrink!
7. Execute the report.=> It is correctly displayed on multiple pages.

8. Export the report in PDF and printed it. => There are 4 pages resulted, each one containing a part of the image.