Barcode example

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicBarcode Creator for .NET (v2)  /  Barcode example

DynamicBarcode Creator for .NET (v2) Forum

 Dec 06 2017 5:10 PM
Can somebody point me to an example where a barcode is created in memory and then drawn to a PDF file that is also in memory?
 Dec 07 2017 11:11 AM
Posted by a ceTe Software moderator
Hello,

Yes, you can output the barcode in the form of byte array using DynamicBarcode Creator product. You can refer to the documentation on outputting barcode image in the form of byte array here.

It is not possible to add the barcode to the PDF using DynamicBarcode Creator product alone. You will need to use the DynamicPDF Generator product.  You will need to get the barcode as byte array and then add it to the PDF using Generator product. Also you can output the PDF in the form of byte array or Stream using Generator product. Please refer to the documentation on document output here.

Also please note that DynamicBarcode Creator and DynamicPDF Generator are two separate and independent products. Below is the code sample for adding barcode to the PDF.

            ceTe.DynamicBarcode.Creator.Code128 barcode128Obj = new ceTe.DynamicBarcode.Creator.Code128("Code128 barcode", 150);
            barcode128Obj.ShowText = true;
            //Outputting barcode in the form of byte array.
            byte[] barcodeByteData= barcode128Obj.Draw(300, ImageFormat.Png);
          
            //Adding image data to the PDF using DynamicPDF Generator product.
            Document document = new Document();
            Page page = new Page();
            ImageData imageDataObj = ImageData.GetImage(barcodeByteData);
            ceTe.DynamicPDF.PageElements.Image imageObj = new ceTe.DynamicPDF.PageElements.Image(imageDataObj, 10, 10);
            //Add image to the PDF page.
            page.Elements.Add(imageObj);
            //Add page to the document.
            document.Pages.Add(page);
            //Draw the PDF into byte array.
            byte[] pdfByteData=document.Draw();

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 3:19 AM.