ImageExtractTest.vb 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. Imports ComPDFKit.PDFDocument
  2. Imports System
  3. Imports System.IO
  4. Module ImageExtractTest
  5. Private outputPath As String = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) & "\Output\VB"
  6. Sub Main()
  7. ' Perparation work
  8. Console.WriteLine("Running Bookmark test sample..." & vbCrLf)
  9. SDKLicenseHelper.LicenseVerify()
  10. Dim document As CPDFDocument = CPDFDocument.InitWithFilePath("CommonFivePage.pdf")
  11. If Not Directory.Exists(outputPath) Then
  12. Directory.CreateDirectory(outputPath)
  13. End If
  14. ' Sample 1: Extract image
  15. ExtractImage(document)
  16. document.Release()
  17. Console.WriteLine("--------------------")
  18. Console.WriteLine("Done")
  19. Console.WriteLine("--------------------")
  20. Console.ReadLine()
  21. End Sub
  22. ' Extract all images from document
  23. Private Sub ExtractImage(document As CPDFDocument)
  24. document.ExtractImage("1-5", outputPath)
  25. End Sub
  26. End Module