This tutorial will help you to extract audio from PDF files in C# and VB.NET using PDF Extractor SDK. Use the source code samples below to extract audio from PDF files.

How to extract audio from a PDF file in C#

using Bytescout.PDFExtractor;

namespace ExtractAudio
	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

			int i = 0;

			// Initialize sound clips enumeration
			if (extractor.GetFirstAudio())
					string outputFileName = "audio" + i + extractor.GetCurrentAudioExtension();

					// Save sound clip to file


				while (extractor.GetNextAudio()); // Advance sounds enumeration

How to extract audio from a PDF file 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

        Dim i As Integer = 0

        ' Initialize sound clips enumeration
        If extractor.GetFirstAudio() Then
                Dim outputFileName As String = "audio" & i & extractor.GetCurrentAudioExtension()

                ' Save sound clip to file

                i = i + 1

            Loop While extractor.GetNextAudio() ' Advance sounds enumeration
        End If

    End Sub
End Class