This sample source code below will demonstrate you how to draw with clipping in PDF in VB.NET. ByteScout PDF SDK is the SDK for pdf documents generation, modification and updates. Can also generate and fill PDF forms. Provides support for text (fonts, style, size, font family), layers, pdf form fields, vector and raster drawings and you can use it to draw with clipping in PDF with VB.NET.
Fast application programming interfaces of ByteScout PDF SDK for VB.NET plus the instruction and the code below will help you quickly learn how to draw with clipping in PDF. In order to implement the functionality, you should copy and paste this code for VB.NET below into your code editor with your app, compile and run your application. Test VB.NET sample code examples whether they respond your needs and requirements for the project.
Download free trial version of ByteScout PDF SDK from our website with this and other source code samples for VB.NET.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
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
60 Day Free Trial or Visit ByteScout PDF SDK Home Page
Explore ByteScout PDF SDK Documentation
Explore Samples
Sign Up for ByteScout PDF SDK Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout PDF SDK Home Page
Explore ByteScout PDF SDK Documentation
Explore Samples
Sign Up for ByteScout PDF SDK Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: