Insert BarCode into an existing tif file...

Last post 02-11-2009, 8:17 AM by saqib.razzaq. 1 replies.
Sort Posts: Previous Next
  •  02-10-2009, 11:31 PM 164528

    Insert BarCode into an existing tif file...

    Hi,
    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.
    Filed under: aspose.barcode
     
  •  02-11-2009, 8:17 AM 164646 in reply to 164528

    Re: Insert BarCode into an existing tif file...

    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);

    pdfFileMend.Close();

    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 http://www.aspose.com/documentation/file-format-components/aspose.pdf.kit-for-.net-and-java/aspose.pdf.kit.pdfcontenteditor.deleteimage_overload_1.html method for deleting images from pdf documents. Please feel free to use http://www.aspose.com/community/forums/aspose.pdf.kit-for-.net-java-and-reporting-services/215/showforum.aspx 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.


    Best Regards,
    Saqib Razzaq
    Support Developer, Aspose Sialkot Team
    http://www.aspose.com
    Your File Format Experts
     
View as RSS news feed in XML