Tuesday 5 February 2013

Display and change images dynamically in XML publisher

This article discusses about how to display images dynamically using XML Publisher.
COMPANY  NAME
ADDRESS
REPORT TITLE
CF_PRINTED
1.
2.
3.
Customer No..
Customer
Name
Address
Tax Category
Number
Name
Address
Tax Category
Note :- We have to place Dummy Images on template like in above template.

1) In this option we placed image path Directly like as follows

By right clicking on Dummy image select SIZE option (office 2007) and click on Alt text Button the following screen will display.


2) In this option we get the image file name in CF.



a) By right click on Dummy image select SIZE option (office 2007) and click on Alt text Button the
 following screen will display




3) In this option we get the Image File path From CF.




b) By right click on Dummy image select SIZE option (office 2007) and click on Alt text Button the following screen will display


OUTPUT:-
 


                                                BLOB is “a collection of binary data stored as a single entity in a database management system. Blobs are typically images, audio or other multimedia objects, though sometimes binary code is stored as a blob. Database support for blobs is not universal.” 
                                   Support for extracting BLOB images to XML is coming, the XMLP extraction engine will extract the images and encode to base64 in the XML, you will then be able to pull this into the output via the RTF template.)



Following are something that you should know:
 


  • Can’t generate xml data for CLOB more than 40 kb in report builder.
  • BLOB Images are supported in XML Publisher 5.6.2 or later.  
  • Encode BLOB to CLOB use this following function:  
  • CREATE FUNCTION getbase64( p_source BLOB ) 
  • RETURN CLOB
  • IS
  • v_result CLOB;
  • BEGIN
  • DBMS_LOB.createtemporary(lob_loc => v_result, CACHE => FALSE, dur => 0);
  • Wf_Mail_Util.EncodeBLOB ( p_source, v_result);
  • RETURN ( v_result ); 
  • END getbase64;   
  •  

  • To show BLOB Images use the following code:

  • <fo:instream-foreign-object content-type=”image/jpg”><xsl:value-of select=”.//IMAGE_”/></fo:instream-foreign-object> 
  • XML Publisher supports in general right now only JPG, GIF and PNG.  

  • Notice the template needs to know the mime type of the image, in this case “image/jpg” The IMAGE_ contains the base64 encoded image data. Template and sample data here (remove the extension .odt  )
     


     

No comments:

Post a Comment