''' <summary>
''' Prints the portfolio structure.
''' </summary>
''' <param name="pdfFilename">The PDF filename.</param>
Public Shared Sub PrintPortfolioStructure(pdfFilename As String)
' open PDF document in read-only mode
Using document As New Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename, True)
' if PDF document does not contain portfolio
If document.Attachments Is Nothing Then
System.Console.WriteLine("Document does not have attachments (portfolio).")
Return
End If
' print initial view mode
System.Console.WriteLine(String.Format("Initial View Mode = {0}", document.Attachments.View))
' print colors information
If document.Attachments.Colors IsNot Nothing Then
PrintPortfolioColors(document.Attachments.Colors)
End If
' print portfolio schema
If document.Attachments.Schema IsNot Nothing Then
PrintPortfolioSchema(document.Attachments.Schema)
End If
' print portfolio sort settings
If document.Attachments.Sort IsNot Nothing Then
PrintPortfolioSort(document.Attachments.Sort)
End If
' print portfolio splitter bar settings
If document.Attachments.SplitterBar IsNot Nothing Then
PrintPortfolioSplitterBar(document.Attachments.SplitterBar)
End If
' print portfolio folders and files
If document.Attachments.RootFolder IsNot Nothing Then
System.Console.WriteLine("Folder structure:")
PrintFolderStructure(document.Attachments.RootFolder, " ")
Else
System.Console.WriteLine("Files:")
PrintFileInfo(document.Attachments.GetFiles(""), " ")
End If
End Using
End Sub
''' <summary>
''' Prints the folder structure.
''' </summary>
''' <param name="folder">The PDF attachment folder.</param>
''' <param name="padding">Padding.</param>
Private Shared Sub PrintFolderStructure(folder As Vintasoft.Imaging.Pdf.Tree.FileAttachments.PdfAttachmentFolder, padding As String)
System.Console.WriteLine(String.Format("{0}Folder: {1}", padding, folder.Name))
padding += " "
PrintFileInfo(folder.Files, padding)
Dim subFolders As Vintasoft.Imaging.Pdf.Tree.FileAttachments.PdfAttachmentFolder() = folder.Folders
If subFolders IsNot Nothing Then
For Each subFolder As Vintasoft.Imaging.Pdf.Tree.FileAttachments.PdfAttachmentFolder In subFolders
PrintFolderStructure(subFolder, padding)
Next
End If
End Sub
''' <summary>
''' Prints the portfolio splitter bar information.
''' </summary>
''' <param name="splitterBar">The splitter bar.</param>
Private Shared Sub PrintPortfolioSplitterBar(splitterBar As Vintasoft.Imaging.Pdf.Tree.FileAttachments.PdfAttachmentCollectionSplitterBar)
System.Console.WriteLine("Splitter Bar:")
System.Console.WriteLine(String.Format(" Direction = {0}", splitterBar.Direction))
System.Console.WriteLine(String.Format(" Position = {0}", splitterBar.Position))
End Sub
''' <summary>
''' Prints an information for specified files.
''' </summary>
''' <param name="fileSpecs">The PDF embedded file specifications.</param>
''' <param name="padding">Padding.</param>
Private Shared Sub PrintFileInfo(fileSpecs As Vintasoft.Imaging.Pdf.Tree.PdfEmbeddedFileSpecification(), padding As String)
For Each fileSpec As Vintasoft.Imaging.Pdf.Tree.PdfEmbeddedFileSpecification In fileSpecs
System.Console.WriteLine(String.Format("{0}File: {1}", padding, fileSpec.Filename))
System.Console.WriteLine(String.Format("{0} CompressedSize = {1}", padding, fileSpec.CompressedSize))
System.Console.WriteLine(String.Format("{0} UncompressedSize = {1}", padding, fileSpec.UncompressedSize))
System.Console.WriteLine(String.Format("{0} Compression = {1}", padding, fileSpec.Compression))
System.Console.WriteLine(String.Format("{0} CreationDate = {1}", padding, fileSpec.CreationDate))
System.Console.WriteLine(String.Format("{0} ModificationDate = {1}", padding, fileSpec.ModificationDate))
System.Console.WriteLine(String.Format("{0} Description = {1}", padding, fileSpec.Description))
System.Console.WriteLine(String.Format("{0} HasThumbnail = {1}", padding, fileSpec.Thumbnail IsNot Nothing))
If fileSpec.DataFields IsNot Nothing Then
System.Console.WriteLine(" DataFields:")
For Each name As String In fileSpec.DataFields.Keys
System.Console.WriteLine(String.Format(" {0}={1}", name, fileSpec.DataFields(name).DataAsString))
Next
End If
Next
End Sub
''' <summary>
''' Prints the portfolio sort properties.
''' </summary>
''' <param name="sort">The PDF attachment collection sort properties.</param>
Private Shared Sub PrintPortfolioSort(sort As Vintasoft.Imaging.Pdf.Tree.FileAttachments.PdfAttachmentCollectionSort)
System.Console.WriteLine("Sort:")
System.Console.WriteLine(" Field names:")
Dim fieldNames As String() = sort.FieldNames
For i As Integer = 0 To fieldNames.Length - 1
System.Console.WriteLine(" {0}: {1}", i, fieldNames(i))
Next
System.Console.WriteLine(" Ascending orders:")
Dim ascendingOrders As Boolean() = sort.AscendingOrders
For i As Integer = 0 To ascendingOrders.Length - 1
System.Console.WriteLine(" {0}: {1}", i, ascendingOrders(i))
Next
End Sub
''' <summary>
''' Prints the portfolio schema.
''' </summary>
''' <param name="schema">The PDF attachment collection schema.</param>
Private Shared Sub PrintPortfolioSchema(schema As Vintasoft.Imaging.Pdf.Tree.FileAttachments.PdfAttachmentCollectionSchema)
System.Console.WriteLine("Schema:")
For Each key As String In schema.Keys
System.Console.WriteLine(String.Format(" {0}:", key))
Dim field As Vintasoft.Imaging.Pdf.Tree.FileAttachments.PdfAttachmentCollectionSchemaField = schema(key)
System.Console.WriteLine(" DataType = {0}", field.DataType)
System.Console.WriteLine(" DisplayedName = {0}", field.DisplayedName)
System.Console.WriteLine(" IsSupportsEditing = {0}", field.IsSupportsEditing)
System.Console.WriteLine(" IsVisible = {0}", field.IsVisible)
System.Console.WriteLine(" Order = {0}", field.Order)
Next
End Sub
''' <summary>
''' Prints the portfolio colors information.
''' </summary>
''' <param name="presentationColors">The presentation colors.</param>
Private Shared Sub PrintPortfolioColors(presentationColors As Vintasoft.Imaging.Pdf.Tree.FileAttachments.PdfPresentationColors)
System.Console.WriteLine("Colors:")
System.Console.WriteLine(String.Format(" Background = {0}", presentationColors.Background))
System.Console.WriteLine(String.Format(" CardBackground = {0}", presentationColors.CardBackground))
System.Console.WriteLine(String.Format(" CardBorder = {0}", presentationColors.CardBorder))
System.Console.WriteLine(String.Format(" PrimaryText = {0}", presentationColors.PrimaryText))
System.Console.WriteLine(String.Format(" SecondaryText = {0}", presentationColors.SecondaryText))
End Sub