ByteScout PDF Extractor SDK – VB.NET – Optimize PDF

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Extractor SDK – VB.NET – Optimize PDF

ByteScout PDF Extractor SDK – VB.NET – Optimize PDF


Imports Bytescout.PDFExtractor

Module Program

    Sub Main()


            Using docOptimizer As New DocumentOptimizer("demo", "demo")

                'Set Optimization Options
                Dim OptimizationOptions = New OptimizationOptions

                'This will resize high resolution images
                OptimizationOptions.ResampleImages = True

                ''Set image optimization format
                'OptimizationOptions.ImageOptimizationFormat = ImageOptimizationFormat.JPEG

                ''Control Optimized image quality, for further fine grained control
                'OptimizationOptions.JPEGQuality = 10

                'Perform Optimization
                docOptimizer.OptimizeDocument("sample.pdf", "sample_optimized.pdf", OptimizationOptions)

                ''Get Optimized file info
                Dim fileInfo_Sample = New System.IO.FileInfo("sample.pdf")
                Dim fileInfo_SampleOptimized = New System.IO.FileInfo("sample_optimized.pdf")

                'Write Stats
                Console.WriteLine("Source File Size: " + fileInfo_Sample.Length.ToString() + " bytes")
                Console.WriteLine("Source File Optimized to Size: " + fileInfo_SampleOptimized.Length.ToString() + " bytes")

            End Using

        Catch ex As Exception
        End Try

        Console.WriteLine("Press any key to exit...")

    End Sub

End Module

  Click here to get your Free Trial version of the SDK