Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can I write barcodes into PDF document in vector form?

0
Posted

How can I write barcodes into PDF document in vector form?

0

[VB.NET] ‘ Important: You need Vintasoft.Barcode.dll, ‘ Vintasoft.Imaging.dll, ‘ Vintasoft.Pdf.dll assemblies ‘ to run this code. Private Shared Sub MarkPDF(ByVal pdfFilename As String) ‘ create barcodeWriter Dim barcodeWriter As New BarcodeWriter() ‘ using DataMatrix 2D barcode barcodeWriter.Settings.Barcode = BarcodeType.DataMatrix ‘ barcode padding Dim padding As Single = 5 ‘ open PDF document Dim document As New PdfDocument(pdfFilename) ‘ foreach pages For i As Integer = 0 To document.Pages.Count – 1 Dim page As PdfPage = document.Pages(i) ‘ barcode value – page number barcodeWriter.Settings.Value = (i + 1).ToString() ‘ write barcode graphics path Dim barcodePath As GraphicsPath = barcodeWriter.GetBarcodeAsGraphicsPath() ‘ translate barcode to right-bottom page corner Using m As New Matrix() Dim barcodeWidth As Single = barcodePath.GetBounds().Width m.Translate(page.MediaBox.Right – barcodeWidth – padding, padding) barcodePath.Transform(m) End Using ‘ fill barcode path Using g As P

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123