Free Support Forum -

Convert Barcode to image and place in pdf

Hi guys,

i have recently downloaded the evaluation copy of the barcode code that saves a barcode into SQL Server. i am using active pdf and i wish to insert the barcode from SQL server into a pdf image field to display it. can anyone give me any guidance on how to do this ??

im using for coding purposes and im also using active pdf toolkit as a mean to populate my pdf in memory. any help on this issue appreciated. at present the barcode is in the binary image format.


Colin Graham

Hello Colin,

Thanks for considering Aspose.Barcode!
Our support team has started working on this issue, we will get back to you A.S.A.P.

Dear Colin,

Thanks for considering Aspose.

We are more than glad to provide you some demo code to demonstrates how to use Aspose.BarCode to insert image to pdf documents. Here are some points we need to make clear:

1) Which product you are using to create the pdf document? Aspose.BarCode provides the function to generate the barcode images in bmp format. If you control supports to insert the bmp image, you can use the BitmapImage property to get the bitmap and insert it to the pdf doc. The following is a demo for Aspose.BarCode and Aspose.Pdf

Me.BarCodeControl1.Resolution.DpiX = 96.0F

Me.BarCodeControl1.Resolution.DpiY = 96.0F

'//Save the barcode image to memorystream

Dim mstream As System.IO.MemoryStream = New System.IO.MemoryStream

Me.BarCodeControl1.BitmapImage.Save(mstream, System.Drawing.Imaging.ImageFormat.Bmp)

'//Create Pdf

Dim pdfFile As New Aspose.Pdf.Pdf

Dim section As Aspose.Pdf.Section = pdfFile.Sections.Add()

'//Insert BarCode Image into pdf

Dim image1 As New Aspose.Pdf.Image

image1.ImageInfo.ImageFileType = Aspose.Pdf.ImageFileType.MemoryBmp

image1.ImageInfo.OpenType = Aspose.Pdf.ImageOpenType.Memory

image1.ImageScale = 0.5

Dim reader As System.IO.BinaryReader = New System.IO.BinaryReader(mstream)

mstream.Position = 0

image1.ImageInfo.MemoryData = reader.ReadBytes(mstream.Length)


'//Save the pdf file


2) It is suggest not to save the barcode image to database, instead you can only save the data that is encoded in the barcode image. And then you can get the data from sql server, and re-generate the barcode image by Aspose.BarCode. Therefore, we can save lots of network transferring and the space of the database.

The attachment of the mail is the demo about how insert barcode to pdf document with Aspose.BarCode and Aspose.Pdf, hope it makes sense.

Feel free to access me with any problems.

Hello Iret,

I am looking for a solution to a similar situation right now. We are already using Aspose.PDF for .Net to convert and merge Word Documents to a PDF file. Now we are trying to add/generate a DataMatrix barcode on each page of the PDF file, with the information such as Page Number, Document Number, etc.

Can you please give me more information on how to do this? Also, I would really appreciate if you could send a demo to try it.



Hi Umanga,

Thanks for your inquiry. You can add a barcode image to each page of PDF file. I will suggest you to go through some helping documentation links below:

In addition, there are also some evaluation limitations. You can avoid evaluation limitations by getting a temporary license for 30 days and try the latest version at your end. Please visit download page here:
Aspose.BarCode for .NET (Latest Version)

You can learn all about how Aspose products are licensed by checking out the Licenses FAQ here:

I hope this will help you. Please let us know in case of further assistance and comments.