How to extract video from PDF in C# and VB.NET using ByteScout 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 extract video from PDF in C# and VB.NET using ByteScout PDF Extractor SDK

  • Home
  • /
  • Articles
  • /
  • How to extract video from PDF in C# and VB.NET using ByteScout PDF Extractor SDK

This tutorial will demonstrate how to extract video from PDF in C# and VB.NET using ByteScout PDF Extractor SDK.

How to extract video from PDF in C#

using Bytescout.PDFExtractor;

namespace ExtractVideo
{
	class Program
	{
		static void Main(string[] args)
		{
            // Create Bytescout.PDFExtractor.MultimediaExtractor instance
            MultimediaExtractor extractor = new MultimediaExtractor();
			extractor.RegistrationName = "demo";
			extractor.RegistrationKey = "demo";
			
			// Load PDF document
			extractor.LoadDocumentFromFile(@"sample.pdf");

			int i = 0;

			// Initialize movies enumeration
			if (extractor.GetFirstVideo())
			{
				do
				{
                    string outputFileName = "movie" + i + extractor.GetCurrentVideoExtension();

					// Save movie to file
					extractor.SaveCurrentVideoToFile(outputFileName);

					i++;

				} 
                while (extractor.GetNextVideo()); // Advance movies enumeration
			}
		}
	}
}

How to extract video from PDF in Visual Basic .NET

Imports Bytescout.PDFExtractor

Class Program
    Friend Shared Sub Main(ByVal args As String())

        ' Create Bytescout.PDFExtractor.MultimediaExtractor instance
        Dim extractor As New MultimediaExtractor()
		extractor.RegistrationName = "demo"
		extractor.RegistrationKey = "demo"

        ' Load sample PDF document
        extractor.LoadDocumentFromFile("sample.pdf")

        Dim i As Integer = 0

        ' Initialize movies enumeration
        If extractor.GetFirstVideo() Then
            Do
                Dim outputFileName As String = "movie" & i & extractor.GetCurrentVideoExtension()

                ' Save movie to file
                extractor.SaveCurrentVideoToFile(outputFileName)

                i = i + 1

            Loop While extractor.GetNextVideo() ' Advance movies enumeration
        End If

    End Sub
End Class

Tutorials:

prev
next