The SDK samples given below describe how to quickly make your application do draw with clipping in pdf with pdf sdk in VB.NET with the help of ByteScout PDF Suite. IF you want to implement the functionality, just copy and paste this code for VB.NET below into your code editor with your app, compile and run your application. Complete and detailed tutorials and documentation are available along with installed ByteScout PDF Suite if you’d like to learn more about the topic and the details of the API.
Trial version of ByteScout PDF Suite is available for free. Source code samples are included to help you with your VB.NET app.
Imports System.Drawing Imports Bytescout.PDF ''' <summary> ''' This example demonstrates how to use the graphics clipping. ''' </summary> Class Program Shared Sub Main() ' Create new document Dim pdfDocument = New Document() pdfDocument.RegistrationName = "demo" pdfDocument.RegistrationKey = "demo" ' Add page Dim page = New Page(PaperFormat.A4) pdfDocument.Pages.Add(page) Dim center = New PointF(200, 200) ' Create clipping path from circle Dim path = New Path() path.AddCircle(center, 100) page.Canvas.SetClip(path) ' Paint Bytescout.PDF.Rectangle over the clipping circle. ' Only part of the Bytescout.PDF.Rectangle intersecting the clipping circle will be drawn. Dim brush = New Bytescout.PDF.SolidBrush(New ColorRGB(255, 0, 0)) page.Canvas.DrawRectangle(brush, center.X - 50, center.Y - 50, 200, 200) ' 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