How to Rotate PDF in C#, VB.NET, and VBScript using PDF Extractor SDK - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

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#

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

How to Rotate PDF by Degrees in Visual Basic .NET

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

How to Rotate PDF by Degrees in VBScript (Visual Basic 6)

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

Tutorials:

prev
next