Create highlighted text in PDF document with Visual Basic for .NET and Bytescout.PDF library for .NET

Highlighting text in a PDF document generated using Bytescout.PDF library

This example provides a VB.NET (for .NET) to add hightlighted text in PDF generated using Bytescout.PDF library for NET

Download example source code: bytescoutpdf_highlighted_text_effect.zip (10 KB)

PDF with hightlighted text  added using Bytescout.PDF library for .NET

Imports Bytescout.PDF

Module Module1

Sub Main()
' Create main PDF Doc Engine
Dim engine As New PDFDocEngine("", "")

' Add new document
Dim document As Document = engine.AddDocument()

' Append new page to the document
Dim page As Page = document.AddPage(PageSizeType.A3, PageOrientationType.LandScape)

' Create new drawing
Dim drawing As Drawing = page.AddDrawing()

' Add standard font
Dim font As UInteger = document.AddFontStandard(StandardFontType.Courier, FontEncodingType.WinAnsi)

' Set Active Font
drawing.SetActiveFont(font, 50, False, False)

drawing.SetFillColor(Bytescout.PDF.Drawing.RGBToColor(127, 127, 127))

'Draw rectangle
drawing.rectangle(100, 100, 500, 150)

drawing.Fill()

drawing.SetFillColor(Bytescout.PDF.Drawing.RGBToColor(200, 140, 170))

' Draw Text
drawing.PlaceText(100, 100, 0, "Hello World!")

drawing.Fill()

' Closing drawing on the page
drawing.Close()

' Save document
document.Save("HighLightedText.pdf")

' open PDF document in default PDF reader
Process.Start("HighlightedText.pdf")
End Sub

End Module

Download example source code: bytescoutpdf_highlighted_text_effect.zip (10 KB)

Filed in: PDF SDK for .NET

Tutorials: