The sample source codes on this page shows how to draw with graphics state in PDF in VB.NET. ByteScout PDF SDK is the component to help programmers in generating new pdf files, modifying and updating existing pdf documents or pdf forms. Provides support for auto-filling pdf forms, adding text with adjustable font, style, size, font family, new form fields, vector and raster drawings and you can use it to draw with graphics state in PDF with VB.NET.
The SDK samples like this one below explain how to quickly make your application do draw with graphics state 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! Enjoy writing a code with ready-to-use sample codes in VB.NET.
Trial version of ByteScout PDF SDK is available for free. Source code samples are included to help you with your VB.NET app.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
Imports Bytescout.PDF ''' <summary> ''' This example demonstrates how to save and restore the graphics state. ''' </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 canvas = page.Canvas ' Keep current graphics state canvas.SaveGraphicsState() ' Transform coordinates and draw rectangle canvas.TranslateTransform(200, 200) canvas.RotateTransform(45) canvas.DrawRectangle(New SolidBrush(New ColorRGB(0, 0, 255)), 0, 0, 100, 100) ' Restore the state and draw the same rectangle canvas.RestoreGraphicsState() canvas.DrawRectangle(New SolidBrush(New ColorRGB(255, 0, 0)), 200, 200, 100, 100) ' 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: