We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Multiple Overlay in Datamatrix

I used aspose to convert the pdf document into bitmap image (Overlay pdf also done in the procedure). Now, i want created the Data matrix barcode of the pdf and want to overlay it.
Is there anybody knows how to overlay the barcode?? I couldnt find any solution in examples of C#!!



Thank you for your inquiry. Please explain in detail about your requirement. what exactly you want to perform using Aspose.BarCode APIs.

Right now i want to add barcode to my existing pdf. Here by i am mentioning the rpogram as well

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Aspose.Pdf;
using Aspose.Pdf.Facades;
using Aspose.BarCode;
using Aspose.BarCode.Generation;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;

namespace Add_barcode_to_pdf
class ImageFromLocalDisk
static void Main(string[] args)
// ExStart:ImageFromMemory
// The path to the documents directory.
string dataDir = “”; // RunExamples.GetDataDir_AsposePdfGenerator_General();

            // Set the license for Aspose.Pdf
            Aspose.Pdf.License license = new Aspose.Pdf.License();

            // Create a memory stream object
            System.IO.MemoryStream mstream = new System.IO.MemoryStream();

            // Instantiate a Pdf object
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Create a new section in the Pdf document
            Aspose.Pdf.Generator.Section sec1 = new Aspose.Pdf.Generator.Section(pdf1);

            // Add the section in the sections collection of the Pdf document

            // Create an image object
            Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image(sec1);

            // Add the image into paragraphs collection of the section

            image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Bmp;

            // Set the ImageStream to a MemoryStream object
            image1.ImageInfo.ImageStream = mstream;

            // Set desired the image scale
            image1.ImageScale = 0.5F;

            // Save the Pdf
            pdf1.Save(dataDir + "ImageFromMemory_out.pdf");
            // ExEnd:ImageFromMemory
        catch (Exception ex)
            Console.WriteLine(ex.Message + "default.aspx.");


I dont know how to add Generator and aspose.pdf.generator in my refrences and because of that, i am getting the error. Can you please help me to solve this issue??


Please refer to our documentation link Add Image to Existing PDF File. You can find details about how to add an image to existing PDF file. For the above purpose you have to download Aspose.Pdf and add its reference to your project. In this way you can access the Aspose.Pdf namspace.