On this page you will learn from code samples for programming in VB.NET.Writing of the code to set invisible text over image in PDF in VB.NET can be done by developers of any level using ByteScout PDF SDK. ByteScout PDF SDK: the pdf library that can create, update and modify PDF files. Supports text with fonts and style selections, layers, form fields, drawing lines and objects, automatic tables, images. Can be used to create and fill pdf forms. It can set invisible text over image in PDF in VB.NET.
The SDK samples like this one below explain how to quickly make your application do set invisible text over image in PDF in VB.NET with the help of ByteScout PDF SDK. This VB.NET sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Use of ByteScout PDF SDK in VB.NET is also explained in the documentation included along with the product.
Download free trial version of ByteScout PDF SDK from our website with this and other source code samples for VB.NET.
Imports Bytescout.PDF ''' <summary> ''' This example demonstrates how to create PDF document from scanned document image and add invisible text over it. ''' </summary> Class Program Shared Sub Main() ' Create new PDF document Dim pdfDocument = New Document() pdfDocument.RegistrationName = "demo" pdfDocument.RegistrationKey = "demo" ' Load image from file to System.Drawing.Image object (we need it to get the image resolution) Dim sysImage As System.Drawing.Image = System.Drawing.Image.FromFile(".\scanned-invoice.png") ' Compute image size in PDF units (Points) Dim widthInPoints As Single = sysImage.Width / sysImage.HorizontalResolution * 72.0F Dim heightInPoints As Single = sysImage.Height / sysImage.VerticalResolution * 72.0F ' Create page of computed size Dim page = New Page(widthInPoints, heightInPoints) ' Add page to the document pdfDocument.Pages.Add(page) Dim canvas = page.Canvas ' Create Bytescout.PDF.Image object from loaded image Dim pdfImage = New Image(sysImage) ' Draw the image canvas.DrawImage(pdfImage, 0, 0, widthInPoints, heightInPoints) ' Dispose the System.Drawing.Image object to free resources sysImage.Dispose() ' Create brush Dim transparentBrush As SolidBrush = New SolidBrush(New ColorGray(0)) ' ... and make it transparent transparentBrush.Opacity = 0 ' Draw text with transparent brush Dim font16 As Font = New Font(StandardFonts.Helvetica, 16) canvas.DrawString("Your Company Name", font16, transparentBrush, 40, 40) ' Draw another text Dim font10 As Font = New Font(StandardFonts.Helvetica, 10) canvas.DrawString("Your Address", font10, transparentBrush, 40, 80) ' Save document to file pdfDocument.Save("result.pdf") ' Cleanup pdfDocument.Dispose() ' Open document in default PDF viewer app Process.Start("result.pdf") End Sub End Class