How to rotate PDF in C#, VB.NET, and VBScript using PDF Extractor SDK

  • Home
  • /
  • Articles
  • /
  • How to rotate PDF in C#, VB.NET, and VBScript using PDF Extractor SDK

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:

How 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");
		}
	}
}

How 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

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
prev
next