' For complete examples and data files, please go to https://github.com/groupdocs-metadata/GroupDocs.Metadata-for-.NET
Dim format As FormatBase = FormatFactory.RecognizeFormat(Common.MapSourceFilePath(filePath))
If format.Type.ToString().ToLower() = "doc" Then
' initialize DocFormat
Dim docFormat As New DocFormat(Common.MapSourceFilePath(filePath))
' determines whether document is protected by password
Console.WriteLine(If(docFormat.IsProtected, "Document is protected", "Document is protected"))
ElseIf format.Type.ToString().ToLower() = "pdf" Then
' initialize DocFormat
Dim pdfFormat As New PdfFormat(Common.MapSourceFilePath(filePath))
' determines whether document is protected by password
Console.WriteLine(If(pdfFormat.IsProtected, "Document is protected", "Document is protected"))
ElseIf format.Type.ToString().ToLower() = "xls" Then
' initialize DocFormat
Dim xlsFormat As New XlsFormat(Common.MapSourceFilePath(filePath))
' determines whether document is protected by password
Console.WriteLine(If(xlsFormat.IsProtected, "Document is protected", "Document is protected"))
ElseIf format.Type.ToString().ToLower() = "ppt" Then
' initialize DocFormat
Dim pptFormat As New PptFormat(Common.MapSourceFilePath(filePath))
' determines whether document is protected by password
Console.WriteLine(If(pptFormat.IsProtected, "Document is protected", "Document is protected"))
Else
Console.WriteLine("Invalid Format.")