Header Ads

Header ADS

Barcode Generate Based on Static Value & Print On Oracle Apex

Barcode Generate Based on Static Value & Print On Oracle Apex

Topic Introduction: I will discuss Barcode Generate & Print On Oracle Apex in this tutorial. here 2 type barcodes will be printed 1. Static Barcode  2. Barcode by SQL Query.

Here we will learn how to generate a barcode based on static value and print out this barcode page.
follow step by step to make a barcode.




Static Barcode:


Barcode Generate & Print On Oracle Apex


1. Create a blank page
2. Take a Region
3. Create two-page items, one for Barcode value and another for Quantity which means how much Barcode Quantity will be generated.
4. Create a submit Button for barcode generation.
5. Create a subregion Region type that will be Dynamic Content and On PL/SQL code block past the PL/SQL Code.

DECLARE
    v_qty   NUMBER;
BEGIN
    v_qty := NVL (:P2_QTY, 0);

    FOR i IN 1 .. v_qty
    LOOP
        HTP.p ('<img style= "height:80px;" src="https://barcode.tec-it.com/barcode.ashx?data='|| HTF.escape_sc (:P2_BARCODE)|| '" alt="barcode"/>&nbsp;&nbsp;&nbsp;&nbsp;');
    END LOOP;

    HTP.p ('
<div>');
END;


Here Barcode Generate Complete.
6. Now if you want to Print this barcode region Add some code to the previous PL/SQL Block. Write this code on PL/SQL execution section after the Begin keyword.

Htp.p('<input type="button1" class="t-Icon t-Icon--right fa fa-print" id="print" type="button" onclick="printdiv(''div_print1'');" value="print"/><br/><div id="div_print1" style="margin-top:5px;">');

7. Write the Javascript code to the page properties Function and Global variable Declaration box

function printdiv(printpage)
{
var headstr = "<html><head><title></title></head><body>";
var footstr = "</body>";
var newstr = document.all.item(printpage).innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = headstr+newstr+footstr;
window.print();
document.body.innerHTML = oldstr;
return false
}



No comments

Theme images by Deejpilot. Powered by Blogger.