Check the samples below to learn how to rotate a PDF document by degrees in C#, VB.NET, and VBScript using ByteScout PDF Extractor SDK.
Select your programming language:
Use the following source code sample to rotate PDF by degrees in C#.
using System.Diagnostics; using Bytescout.PDFExtractor; namespace RotateDocument { class Program { static void Main(string[] args) { string inputFile = "sample1.pdf"; using (DocumentRotator rotator = new DocumentRotator("demo", "demo")) { rotator.Rotate(inputFile, "result.pdf", RotationAngle.Deg90); } Process.Start("result.pdf"); } } }
Check out this code snippet below to rotate PDF by degrees in Visual Basic .NET.
Imports Bytescout.PDFExtractor Imports System.Diagnostics Class Program Friend Shared Sub Main(args As String()) Dim inputFile As String = "sample1.pdf" Using rotator As New DocumentRotator("demo", "demo") rotator.Rotate(inputFile, "result.pdf", RotationAngle.Deg90) End Using Process.Start("result.pdf") End Sub End Class
The code sample below will demonstrate how to rotate PDF by degrees in VBScript (Visual Basic 6).
' Create Bytescout.PDFExtractor.DocumentRotator object Set rotator = CreateObject("Bytescout.PDFExtractor.DocumentRotator") rotator.RegistrationName = "demo" rotator.RegistrationKey = "demo" rotator.Rotate "..\..\sample1.pdf", "result.pdf", 0 ' 0 - rotate 90 deg, 1 - rotate 180 deg, 2 - rotate 270 deg Set rotator = Nothing