Insert BarCode into an existing tif file



I have used your ASPOSE.Total product since a long time and this it workss fine every time. Now I have a requirement to insert a barcode into an existing tif image or PDF file. I check your demos but found no response for this.

My requirement is:-

Suppose we have a tif file named abc.tif and it contains one barcode on the top. Now I want to nsert another barcode near about other one. Please give me suggestions to achieve this ASAP.

Thanx for help!!!

Please also tell me that how can I remove all the barcodes from a tif file or PDF file by using aspose.barcode in dot net.


Hi Munendra,

Thanks for considering Aspose.

Inserting the barcode in existing tif image is not supported in Aspose.BarCode, but you can insert the barcode image in an existing pdf file using Aspose.BarCode and Aspose.Pdf.Kit libraries. Here is the sample code for generating a barcode and inserting in an existing pdf file:

// generate a barcode image

BarCodeBuilder barcode = new BarCodeBuilder("test-123", Symbology.Code39Extended);

MemoryStream stream = new MemoryStream();

barcode.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp);

stream.Position = 0;

// read the stream in image to get the coordinates

Bitmap bmp = new Bitmap(stream);

int nHeight = bmp.Height;

int nWidth = bmp.Width;

stream.Position = 0;

// use Aspose.pdf.kit to insert image in existing pdf

string strPdfFile = @"E:\Data\Aspose\temp\test.pdf";

PdfFileMend pdfFileMend = new PdfFileMend(strPdfFile, strPdfFile);

// pass the image stream, page number and coordinates to the method

pdfFileMend.AddImage(stream, 1, 5, 5, nHeight, nWidth);


Removing the barcode images from pdf are currently out of scope of Aspose.BarCode product. You can acheive this using Aspose.Pdf.Kit component. Please check method for deleting images from pdf documents. Please feel free to use forum for support related to the Pdf.Kit library.

While deleting the images, you need to check whether the image contains the barcode or not. If all the images in the pdf file are barcode images, then you can simply delete all the images, otherwise, you need to use recognition for each image to check whether it contains barcode or not.


Hello Saqib,
Do you have this sample code for and aspose.barcode.
i am looking to do the same,
I need to create a barcode in memory then open an existing PDF document then insert that created bacode into it.
Remember the target PDF document is a PDF Form which contains input fields, i already populate those field now i need to also insert a barcode somewhere on the bottom.
Also can i make the label smaller now it is to high, i would like to make it short and narrow, but the captions must be readable and big.
Than you very much in advance,


A similar query is replied here for your issue. Please review it and if your issue is different, create a new thread and provide all the details along with the sample code, template files, output files and images showing issue. We will reproduce the issue here and provide assistance accordingly.