Printing Bar Code in Oracle Apex

Bar Code report in Oracle Apex




Steps:


1.  Download barcode font 

2. Upload the both .ttf & .woff font in Application > Shared Component > Static Application Files

3. Write the below code 
    a. Pages Designer > Javascript > Function and Global Variable Declaration

function printContent(el){
      var restorepage = $('body').html();
      var printcontent = $('#' + el).clone();
      $('body').empty().html(printcontent);
      window.print();
      $('body').html(restorepage);
      }

   b. Pages Designer > CSS > Inline

@font-face {  
 font-family: 'barcode';  
        src: url('#APP_IMAGES#Code39Azalea.ttf') format('truetype');  
        src: url('#APP_IMAGES#Code39Azalea.woff') format('woff');   
 font-weight: normal;  
 font-style: normal;  

@font-face {
    font-family: "3 of 9 Barcode";
    src: url(#APP_IMAGES#FRE3OF9X.TTF) format("truetype");
    font-weight: normal;
    font-style: normal;
    }
.demo  
 {  
     font-family:'barcode',Code39;  
     width:200px;  
     margin:10px auto;  
     text-align:left;  
     padding:10px;  
     font-size:24pt; 
.barCode 
{
     font-family:'barcode',Code39Azalea;  
     width:200px;  
     margin:10px auto;  
     text-align:left;  
     border:1px solid #666;  
     padding:10px;  
     font-size:24pt; 
}

 3. Make PL/SQL Dynamic content Region as sample below

begin
htp.p('<html>');
htp.p('<head>');
htp.p('<style>');

htp.p('@font-face {
    font-family: "barcode";
    src: url(#APP_IMAGES#Code39Azalea.ttf) format("truetype");
    font-weight: normal;
    font-style: normal;
    }
.demo1  
 {  
     font-family:''barcode'',Code39Azalea;       
     width:50px;  
     text-align:left;  
     font-size:40pt;    
}');

htp.p('</style>');htp.p('</head>');

      htp.p('Printing Barcode');
      htp.p('<br>'); htp.p('<br>'); htp.p('<br>');
      for i in (
      select '*12345*' tag from dual
      union
      select '*43543*' tag from dual
      union
      select '*45345*' tag from dual
      union
      select '*89089*' tag from dual
      union
      select '*76867*' tag from dual
      union
      select '*45645*' tag from dual
      union
      select '*23423*' tag from dual) 
  loop
     htp.p('<p class="demo1">'); htp.p(i.tag); htp.p('</p>'); 
     htp.p('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
                         htp.p('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
     htp.p(i.tag); htp.p('<br>');  
     htp.p('<b>'); htp.p('DESC: CPU DELL OPTIPLEX 9020 MT');  htp.p('<br>');  
     htp.p('MODEL: 2013');    htp.p('<br>');
     htp.p('S.NO: 7843A21DF');    htp.p('<br>');
     htp.p('<br>');htp.p('<br>'); htp.p('<br>');htp.p('<br>');
     htp.p('</b>'); htp.p('<br>');htp.p('<br>'); htp.p('</b>');
  end loop;
     htp.p('');
   end;

 

Comments

Popular posts from this blog

Displaying Images in Oracle Apex

Customize Apex Login