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

Free Support Forum - aspose.com

Very precise printing needed

Dear Support Staff,

I am doing a project using your prestigious product. I have to print the GS1Datamatrix using aspose.net on pre-printed labels. The space provided on pre-printed labels is very calculated. Please advise how I can print such labels with high accuracy

Many Thanks


I have observed the issue shared by you and request you to please share which product you are using on your end along with information about source file, generated output and used sample code. We will be able to investigate the issue further on our end on provision of requested information.

Dear Fayyaz,

I am very thankful for your prompt response. I am using Aspose.net barcode. I have to print barcode on very specific location on pre-printed labels. I am attaching sample file for pre-printed label.Problem.png (8.4 KB)

Many Thanks


Thank you for your feedback. We are investigating your specific scenario and will update you as soon as additional information is available.


You can create a PDF file according to the dimensions of the document and position the Barcode image on the document using Aspose.PDF for .NET API. Given below is the sample code snippet that you can use to generate the document. Please modify the height and width according to the actual document.

Dim doc As Aspose.Pdf.Document = New Aspose.Pdf.Document()
Dim page As Aspose.Pdf.Page = doc.Pages.Add()
page.PageInfo.Height = 3 * 72
page.PageInfo.Width = 7 * 72
page.PageInfo.Margin = New Aspose.Pdf.MarginInfo(2 * 72, .5 * 72, .2 * 72, .5 * 72)
Dim BarCodeImage As Aspose.Pdf.Image = New Aspose.Pdf.Image()
BarCodeImage.File = "TestGS1DataMatrix.png"
BarCodeImage.FixHeight = 2 * 72
BarCodeImage.FixWidth = 4 * 72

Furthermore, to generate Barcode with specified dimensions, you can use the code snippet provided on the link given below.
Units based Barcode Generation
We hope that this answered your question. In case our understanding of your requirements is not correct, please share a bit more details so that we can assist you further.

Dear Ahmad,

Thanks for your quick support. I am sorry that I might not communicate my issue properly to you. Actually, I have to print the GS1Datamatrix directly, (Without saving it as PNG or BMP using builder.print). The Space, where I have to print GS1Datamatrix, is very calculated (I am attaching Sample FIle). For printing precisely, Page Size, Margins etc should be set to get the job done. I am expecting to get help on setting page size, margins, Human Readable Text settings etc. Please help me in sorting this issue.

Many ThanksProblem.png (8.4 KB)


You may set the margins for the Barcode by using the code snippet given below.

builder.Margins = New Aspose.BarCode.MarginsF(20, 2, 2, 3)

To set the font of the text displayed, use builder.CodeTextFont property.

builder.CodeTextFont = New System.Drawing.Font("Verdana", 50.0F)

To set the size of the generated Barcode image, you may set the ImageHeight and ImageWidth properties.

builder.GraphicsUnit = GraphicsUnit.Inch
builder.ImageHeight = 3
builder.ImageWidth = 7

We hope that this solved the issue that you were facing. Please feel free to reach us if additional information is required.