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
beginhtp.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 dualunionselect '*43543*' tag from dualunionselect '*45345*' tag from dualunionselect '*89089*' tag from dualunionselect '*76867*' tag from dualunionselect '*45645*' tag from dualunionselect '*23423*' tag from dual)loophtp.p('<p class="demo1">'); htp.p(i.tag); htp.p('</p>');htp.p(' ');
htp.p(' ');
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
Post a Comment