Platforms to show: All Mac Windows Linux Cross-Platform

/DynaPDF/Parser/Show PDF Content


Last modified Wed, 12th May 2026.

You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /DynaPDF/Parser/Show PDF Content

Download this example: Show PDF Content.zip

Project "Show PDF Content.xojo_binary_project"
Class App Inherits DesktopApplication
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub DocumentCreated() If DebugBuild Then Var file As FolderItem = GetFolderItem("dynapdf_help.pdf") If file.Exists Then OpenDocument file return end if end if Var dlg As New OpenFileDialog dlg.Title = "Select PDF file" dlg.PromptText = "Select one or more files" dlg.AllowMultipleSelections = True dlg.Filter = FileTypeGroup1.Pdf Var f As FolderItem = dlg.ShowModal For Each file As FolderItem In dlg.SelectedFiles OpenDocument file Next End EventHandler
EventHandler Sub DocumentOpened(item As FolderItem) Var w As New ContentWindow(item) End EventHandler
EventHandler Sub Opening() End EventHandler
End Class
Class ContentWindow Inherits DesktopWindow
Control List Inherits DesktopListBox
ControlInstance List Inherits DesktopListBox
EventHandler Sub RowExpanded(row As Integer) Var v As Variant = Me.RowTagAt(row) add v End EventHandler
End Control
Function FileExpandall() As Boolean Var u As Integer = List.LastRowIndex For i As Integer = u DownTo 0 If List.RowExpandableAt(i) Then list.RowExpandedAt(i) = True end if next Return True End Function
Sub Add(v as Variant) If v = Nil Then // ignore elseIf v IsA DynaPDFParserMBS Then Var p As DynaPDFParserMBS = v Var contents() As DynaPDFParserContentMBS = p.Contents For Each content As DynaPDFParserContentMBS In contents list.AddFolder content.OperatorName, content Next ElseIf v IsA DynaPDFParserContentIntMBS Then Var p As DynaPDFParserContentIntMBS = v List.AddRow "Value", p.Value.ToString ElseIf v IsA DynaPDFParserContentFloatMBS Then Var p As DynaPDFParserContentFloatMBS = v List.AddRow "Value", p.Value.ToString ElseIf v IsA DynaPDFParserContentBeginMarkedContentMBS Then AddDynaPDFParserContentBeginMarkedContent v ElseIf v IsA DynaPDFParserContentClipPathExtMBS Then Var p As DynaPDFParserContentClipPathExtMBS = v List.AddFolder "BBox", p.BBox List.AddRow "Mode", p.Mode.ToString List.AddRow "Index", p.Index.ToString List.AddRow "EvenOdd", p.EvenOdd.ToString ElseIf v IsA DynaPDFParserContentClipPathMBS Then Var p As DynaPDFParserContentClipPathMBS = v List.AddFolder "BBox", p.BBox List.AddRow "Mode", p.Mode.ToString List.AddRow "VerticesCount", p.VerticesCount.ToString List.AddFolder "Vertices", p.Vertices List.AddRow "OPCount", p.OPCount.ToString List.AddFolder "OP", p.OP List.AddRow "EvenOdd", p.EvenOdd.ToString ElseIf v IsA DynaPDFParserContentColorMBS Then Var p As DynaPDFParserContentColorMBS = v List.AddRow "DeviceColor", p.DeviceColor.ToString List.AddRow "NumComponents", p.NumComponents.ToString List.AddRow "CS", p.CS.ToString List.AddRow "ColorSpace", p.ColorSpace.ToString List.AddRow "BaseColorSpace", p.BaseColorSpace.ToString List.AddRow "Values", StringFromArray(p.Values) ElseIf v IsA DynaPDFParserContentColorSpaceMBS Then Var p As DynaPDFParserContentColorSpaceMBS = v List.AddRow "Name", p.Name List.AddRow "Invisible", p.Invisible.ToString List.AddRow "CS", p.CS.ToString List.AddFolder "CSObj", p.CSObj ElseIf v IsA DynaPDFParserContentDrawGroupMBS Then AddDynaPDFParserContentDrawGroup v ElseIf v IsA DynaPDFParserContentDrawImageMBS Then AddDynaPDFParserContentDrawImage v ElseIf v IsA DynaPDFParserContentDrawInlineImageMBS Then AddDynaPDFParserContentDrawInlineImage v ElseIf v IsA DynaPDFParserContentDrawPathExtMBS Then Var p As DynaPDFParserContentDrawPathExtMBS = v List.AddFolder "BBox", p.BBox List.AddRow "Mode", p.Mode.ToString List.AddRow "Index", p.Index.ToString ElseIf v IsA DynaPDFParserContentDrawPathMBS Then Var p As DynaPDFParserContentDrawPathMBS = v List.AddFolder "BBox", p.BBox List.AddRow "Mode", p.Mode.ToString List.AddRow "VerticesCount", p.VerticesCount.ToString List.AddFolder "Vertices", p.Vertices List.AddRow "OPCount", p.OPCount.ToString List.AddFolder "OP", p.OP ElseIf v IsA DynaPDFParserContentDrawShadingMBS Then Var p As DynaPDFParserContentDrawShadingMBS = v List.AddRow "ShadingType", p.ShadingType.ToString List.AddRow "Name", p.Name ElseIf v IsA DynaPDFParserContentDrawTemplateMBS Then AddDynaPDFParserContentDrawTemplate v ElseIf v IsA DynaPDFParserContentExtGStateMBS Then AddDynaPDFParserContentExtGState v ElseIf v IsA DynaPDFParserContentFontMBS Then Var p As DynaPDFParserContentFontMBS = v List.AddRow "FontSize", p.FontSize.ToString List.AddRow "Name", p.Name List.AddFolder "FontBBox", p.FontBBox List.AddFolder "Font", p.Font List.AddFolder "FontInfo", p.FontInfo ElseIf v IsA DynaPDFParserContentInitType3GlyphMBS Then Var p As DynaPDFParserContentInitType3GlyphMBS = v List.AddRow "Wx", p.Wx.ToString List.AddRow "Wy", p.Wy.ToString if p.BBox <> nil then List.AddFolder "BBox", p.BBox End If ElseIf v IsA DynaPDFParserContentInsertPostscriptMBS Then Var p As DynaPDFParserContentInsertPostscriptMBS = v List.AddRow "Name", p.Name List.AddRow "BufSize", p.BufSize.ToString ElseIf v IsA DynaPDFParserContentLineDashPatternMBS Then Var p As DynaPDFParserContentLineDashPatternMBS = v List.AddRow "DashLen", p.DashLen.ToString List.AddRow "Phase", p.Phase.ToString List.AddFolder "Dash", p.Dash ElseIf v IsA DynaPDFParserContentMarkedContPntMBS Then Var p As DynaPDFParserContentMarkedContPntMBS = v List.AddRow "Name", p.Name List.AddRow "Parms", p.Parms List.AddRow "Tag", p.Tag List.AddRow "Visible", p.Visible.ToString ElseIf v IsA DynaPDFParserContentMulMatrixMBS Then Var p As DynaPDFParserContentMulMatrixMBS = v List.AddRow "Matrix", StringFromArray(p.Matrix) ElseIf v IsA DynaPDFParserContentOutlineMBS Then Var p As DynaPDFParserContentOutlineMBS = v List.AddRow "Width", p.Width.ToString List.AddRow "ElemsCount", p.ElemsCount.ToString List.AddFolder "NextOutline", p.NextOutline List.AddFolder "Elems", p.Elems List.AddRow "Matrix", StringFromArray(p.Matrix) ElseIf v IsA DynaPDFParserContentPageHeaderMBS Then AddDynaPDFParserContentPageHeader v ElseIf v IsA DynaPDFParserContentPatternMBS Then AddDynaPDFParserContentPattern v ElseIf v IsA DynaPDFParserContentShowTextExtMBS Then AddDynaPDFParserContentShowTextExt v ElseIf v IsA DynaPDFParserContentShowTextMBS Then AddDynaPDFParserContentShowText v ElseIf v IsA DynaPDFParserContentSoftMaskMBS Then Var p As DynaPDFParserContentSoftMaskMBS = v List.AddRow "BackColorCS", p.BackColorCS.ToString List.AddRow "BackColor", p.BackColor.ToString List.AddRow "Luminosity", p.Luminosity.ToString List.AddFolder "TranspGroup", p.TranspGroup ElseIf v IsA DynaPDFParserContentTextNodeMBS Then AddDynaPDFParserContentTextNode v ElseIf v IsA DynaPDFParserContentShowTextExtMBS Then AddDynaPDFParserContentShowTextExt v ElseIf v IsA DynaPDFParserContentMBS Then Var p As DynaPDFParserContentMBS = v // nothing ElseIf v IsA DynaPDFColorSpaceMBS Then AddDynaPDFColorSpace v ElseIf v IsA DynaPDFImageMBS Then AddDynaPDFImage v ElseIf v IsA DynaPDFFontMBS Then AddDynaPDFFont v ElseIf v IsA DynaPDFFontInfoMBS Then AddDynaPDFFontInfo v ElseIf v IsA DynaPDFDeviceNAttributesMBS Then Var p As DynaPDFDeviceNAttributesMBS = v List.AddRow "ProcessColorantsCount", p.ProcessColorantsCount.ToString List.AddRow "SeparationsCount", p.SeparationsCount.ToString List.AddFolder "ProcessColorSpace", p.ProcessColorSpace List.AddFolder "ProcessColorants", p.ProcessColorants List.AddFolder "Separations", p.Separations Elseif v IsA DynaPDFMatrixMBS Then var p as DynaPDFMatrixMBS = v List.AddRow "Matrix", p.stringValue ElseIf v IsA DynaPDFRectMBS Then Var p As DynaPDFRectMBS = v List.AddRow "Left", p.Left.ToString List.AddRow "Top", p.Top.ToString List.AddRow "Right", p.Right.ToString List.AddRow "Bottom", p.Bottom.ToString ElseIf v IsA DynaPDFPointMBS Then Var p As DynaPDFPointMBS = v List.AddRow "X", p.X.ToString List.AddRow "Y", p.Y.ToString ElseIf v.IsArray Then If v.ArrayElementType = v.TypeInt32 Then Var u() As Int32 = v For Each w As Int32 In u List.AddRow "Value", w.ToString next elseIf v.ArrayElementType = v.TypeInt64 Then Var u() As Int64 = v For Each w As Int64 In u List.AddRow "Value", w.ToString Next ElseIf v.ArrayElementType = v.TypeSingle Then Var u() As Single = v For Each w As Single In u List.AddRow "Value", w.ToString Next ElseIf v.ArrayElementType = v.TypeDouble Then Var u() As Double = v For Each w As Double In u List.AddRow "Value", w.ToString Next Else Var u As Integer = GetVariantArrayUboundMBS(v) If u = -1 Then // empty variant array else // not empty for i as integer = 0 to u Var av As Variant = GetVariantArrayValueMBS(v, 0) add av next End If end if Else Break // unhandled type End If End Sub
Sub AddDynaPDFColorSpace(p as DynaPDFColorSpaceMBS) List.AddRow "Name", p.Name List.AddRow "Model", p.Model List.AddRow "Manufacturer", p.Manufacturer List.AddRow "Description", p.Description List.AddRow "TypeString", p.TypeString List.AddRow "Name", p.Name List.AddRow "Type", p.Type.ToString List.AddRow "AlternateType", p.AlternateType.ToString List.AddFolder "Alternate", p.Alternate List.AddRow "BufferSize", p.BufferSize.ToString List.AddRow "HasBlackPoint", p.HasBlackPoint.ToString List.AddRow "HasWhitePoint", p.HasWhitePoint.ToString List.AddRow "HasMatrix", p.HasMatrix.ToString List.AddRow "HasGamma", p.HasGamma.ToString List.AddRow "HasRange", p.HasRange.ToString List.AddRow "NumInComponents", p.NumInComponents.ToString List.AddRow "NumOutComponents", p.NumOutComponents.ToString List.AddRow "NumColors", p.NumColors.ToString List.AddRow "ColorantsCount", p.ColorantsCount.ToString List.AddRow "MetadataSize", p.MetadataSize.ToString List.AddRow "Metadata", p.Metadata List.AddFolder "DeviceNAttributes", p.DeviceNAttributes List.AddRow "Handle", p.Handle.ToString List.AddRow "Index", p.Index.ToString End Sub
Sub AddDynaPDFFont(p as DynaPDFFontMBS) List.AddRow "DefWidth", p.DefWidth.ToString List.AddRow "XHeight", p.XHeight.ToString List.AddRow "SpaceWidth", p.SpaceWidth.ToString List.AddRow "ItalicAngle", p.ItalicAngle.ToString List.AddRow "Ascent", p.Ascent.ToString List.AddRow "CapHeight", p.CapHeight.ToString List.AddRow "Descent", p.Descent.ToString List.AddRow "BaseFont", p.BaseFont List.AddRow "FontFamily", p.FontFamily List.AddRow "FontName", p.FontName List.AddRow "FirstChar", p.FirstChar.ToString List.AddRow "Flags", p.Flags.ToString List.AddRow "FontType", p.FontType.ToString List.AddRow "LastChar", p.LastChar.ToString List.AddRow "WidthsCount", p.WidthsCount.ToString List.AddRow "FontFileType", p.FontFileType.ToString List.AddRow "Length1", p.Length1.ToString List.AddRow "Length2", p.Length2.ToString List.AddRow "Length3", p.Length3.ToString List.AddRow "Widths", StringFromArray(p.Widths) End Sub
Sub AddDynaPDFFontInfo(p as DynaPDFFontInfoMBS) List.AddRow "Ascent", p.Ascent.ToString List.AddRow "AvgWidth", p.AvgWidth.ToString List.AddRow "CapHeight", p.CapHeight.ToString List.AddRow "Descent", p.Descent.ToString List.AddRow "FontWeight", p.FontWeight.ToString List.AddRow "ItalicAngle", p.ItalicAngle.ToString List.AddRow "Leading", p.Leading.ToString List.AddRow "MaxWidth", p.MaxWidth.ToString List.AddRow "MisWidth", p.MisWidth.ToString List.AddRow "SpaceWidth", p.SpaceWidth.ToString List.AddRow "StemH", p.StemH.ToString List.AddRow "StemV", p.StemV.ToString List.AddRow "XHeight", p.XHeight.ToString List.AddRow "CharSetSize", p.CharSetSize.ToString List.AddRow "CIDSetSize", p.CIDSetSize.ToString List.AddRow "CIDSupplement", p.CIDSupplement.ToString List.AddRow "CIDToGIDMapSize", p.CIDToGIDMapSize.ToString List.AddRow "CMapBufSize", p.CMapBufSize.ToString List.AddRow "FirstChar", p.FirstChar.ToString List.AddRow "Flags", p.Flags.ToString List.AddRow "FontBufSize", p.FontBufSize.ToString List.AddRow "HorzWidthsCount", p.HorzWidthsCount.ToString List.AddRow "LastChar", p.LastChar.ToString List.AddRow "Length1", p.Length1.ToString List.AddRow "Length2", p.Length2.ToString List.AddRow "Length3", p.Length3.ToString List.AddRow "MetadataSize", p.MetadataSize.ToString List.AddRow "ToUnicodeSize", p.ToUnicodeSize.ToString List.AddRow "VertWidthsCount", p.VertWidthsCount.ToString List.AddRow "WMode", p.WMode.ToString List.AddRow "HaveEncoding", p.HaveEncoding.ToString List.AddRow "Imported", p.Imported.ToString List.AddRow "BaseEncoding", p.BaseEncoding.ToString List.AddRow "FontFileType", p.FontFileType.ToString List.AddRow "FontType", p.FontType.ToString List.AddRow "BaseFont", p.BaseFont List.AddRow "CharSet", p.CharSet List.AddRow "CIDOrdering", p.CIDOrdering List.AddRow "CIDRegistry", p.CIDRegistry List.AddRow "CMapName", p.CMapName List.AddRow "FontFamily", p.FontFamily List.AddRow "FontFilePath", p.FontFilePath List.AddRow "FontName", p.FontName List.AddRow "FontStretch", p.FontStretch List.AddRow "FullName", p.FullName List.AddRow "Lang", p.Lang List.AddRow "PostScriptName", p.PostScriptName List.AddFolder "FontBBox", p.FontBBox List.AddFolder "VertDefPos", p.VertDefPos End Sub
Sub AddDynaPDFImage(p As DynaPDFImageMBS) List.AddRow "ImageIndex", p.ImageIndex.ToString List.AddRow "BufferSize", p.BufferSize.ToString List.AddRow "Filter", p.Filter.ToString List.AddRow "OrgFilter", p.OrgFilter.ToString List.AddRow "JBIG2Globals", p.JBIG2Globals List.AddRow "JBIG2GlobalsSize", p.JBIG2GlobalsSize.ToString List.AddRow "BitsPerPixel", p.BitsPerPixel.ToString List.AddRow "ColorSpace", p.ColorSpace.ToString List.AddRow "NumComponents", p.NumComponents.ToString List.AddRow "MinIsWhite", p.MinIsWhite.ToString List.AddFolder "ColorSpaceObject", p.ColorSpaceObject List.AddRow "ColorCount", p.ColorCount.ToString List.AddRow "Width", p.Width.ToString List.AddRow "Height", p.Height.ToString List.AddRow "ScanLineLength", p.ScanLineLength.ToString List.AddRow "InlineImage", p.InlineImage.ToString List.AddRow "Interpolate", p.Interpolate.ToString List.AddRow "Transparent", p.Transparent.ToString List.AddRow "Intent", p.Intent.ToString List.AddRow "SMaskInData", p.SMaskInData.ToString List.AddRow "OCG", p.OCG.ToString List.AddRow "Metadata", p.Metadata List.AddRow "MetadataSize", p.MetadataSize.ToString List.AddRow "ResolutionX", p.ResolutionX.ToString List.AddRow "ResolutionY", p.ResolutionY.ToString List.AddFolder "Measure", p.Measure List.AddFolder "PtData", p.PtData List.AddRow "IMaskImageHandle", p.IMaskImageHandle.ToString List.AddRow "ISoftMaskHandle", p.ISoftMaskHandle.ToString List.AddRow "FillColor", p.FillColor.ToString List.AddRow "FillColorSpace", p.FillColorSpace.ToString End Sub
Sub AddDynaPDFParserContentBeginMarkedContent(p as DynaPDFParserContentBeginMarkedContentMBS) List.AddRow "Handle", p.Handle.ToString List.AddRow "Visible", p.Visible.ToString List.AddRow "MCType", p.MCType.ToString List.AddRow "Name", p.Name List.AddRow "Parms", p.Parms List.AddRow "Tag", p.Tag End Sub
Sub AddDynaPDFParserContentDrawGroup(p as DynaPDFParserContentDrawGroupMBS) List.AddFolder "BBox", p.BBox List.AddRow "Handle", p.Handle.ToString List.AddRow "OC", p.OC.ToString List.AddRow "BlendCS", p.BlendCS.ToString List.AddRow "Name", p.Name List.AddRow "Flags", p.Flags.ToString List.AddRow "IsIsolated", p.IsIsolated.ToString List.AddRow "IsKnockout", p.IsKnockout.ToString List.AddRow "IsVisible", p.IsVisible.ToString List.AddFolder "BlendCSObj", p.BlendCSObj List.AddRow "ElemsCount", p.ElemsCount.ToString List.AddFolder "Elems", p.Elems List.AddRow "Matrix", StringFromArray(p.Matrix) End Sub
Sub AddDynaPDFParserContentDrawImage(p as DynaPDFParserContentDrawImageMBS) List.AddRow "Name", p.Name List.AddRow "Visible", p.Visible.ToString List.AddRow "OC", p.OC.ToString List.AddRow "Index", p.Index.ToString List.AddFolder "Image", p.Image List.AddRow "ImageHandle", p.ImageHandle.ToString End Sub
Sub AddDynaPDFParserContentDrawInlineImage(p as DynaPDFParserContentDrawInlineImageMBS) List.AddRow "BaseColorSpace", p.BaseColorSpace.ToString List.AddRow "NumComponents", p.NumComponents.ToString List.AddRow "OrgFilter", p.OrgFilter.ToString List.AddRow "Width", p.Width.ToString List.AddRow "Height", p.Height.ToString List.AddRow "Intent", p.Intent.ToString List.AddFolder "ColorSpaceObj", p.ColorSpaceObj List.AddRow "ColorSpace", p.ColorSpace.ToString List.AddRow "ColorSpaceName", p.ColorSpaceName List.AddRow "BufSize", p.BufSize.ToString List.AddRow "BitsPerComponent", p.BitsPerComponent.ToString List.AddRow "ColorCount", p.ColorCount.ToString List.AddRow "ColorTableLen", p.ColorTableLen.ToString List.AddRow "ImageMask", p.ImageMask.ToString List.AddRow "Interpolate", p.Interpolate.ToString List.AddRow "Visible", p.Visible.ToString List.AddRow "Index", p.Index.ToString List.AddFolder "Index", p.Decode End Sub
Sub AddDynaPDFParserContentDrawTemplate(p as DynaPDFParserContentDrawTemplateMBS) List.AddFolder "BBox", p.BBox List.AddRow "Flags", p.Flags.ToString List.AddRow "Handle", p.Handle.ToString List.AddRow "OC", p.OC.ToString List.AddRow "Name", p.Name List.AddFolder "Elems", p.Elems List.AddRow "Matrix", StringFromArray(p.Matrix) End Sub
Sub AddDynaPDFParserContentExtGState(p As DynaPDFParserContentExtGStateMBS) List.AddRow "RenderingIntent", p.RenderingIntent.ToString List.AddRow "OverPrintFill", p.OverPrintFill.ToString List.AddRow "OverPrintStroke", p.OverPrintStroke.ToString List.AddRow "OverPrintMode", p.OverPrintMode.ToString List.AddRow "SoftMaskNone", p.SoftMaskNone.ToString List.AddRow "TextKnockout", p.TextKnockout.ToString List.AddRow "UseBlackPTComp", p.UseBlackPTComp.ToString List.AddRow "SmoothnessTol", p.SmoothnessTol.ToString List.AddRow "StrokeAlpha", p.StrokeAlpha.ToString List.AddRow "FlatnessTol", p.FlatnessTol.ToString List.AddRow "FillAlpha", p.FillAlpha.ToString List.AddRow "BlendMode", p.BlendMode.ToString List.AddRow "AutoStrokeAdjust", p.AutoStrokeAdjust.ToString List.AddRow "AlphaIsShape", p.AlphaIsShape.ToString List.AddRow "Name", p.Name List.AddFolder "SoftMask", p.SoftMask End Sub
Sub AddDynaPDFParserContentPageHeader(p as DynaPDFParserContentPageHeaderMBS) List.AddRow "HaveBBoxes", p.HaveBBoxes.ToString List.AddRow "HaveBlackGeneration", p.HaveBlackGeneration.ToString List.AddRow "HaveTransferFuncs", p.HaveTransferFuncs.ToString List.AddRow "HaveTransparency", p.HaveTransparency.ToString List.AddRow "HaveUnderColorRemoval", p.HaveUnderColorRemoval.ToString List.AddRow "ActionsCount", p.ActionsCount.ToString List.AddRow "AnnotsCount", p.AnnotsCount.ToString List.AddRow "NumClipPaths", p.NumClipPaths.ToString List.AddRow "NumColorants", p.NumColorants.ToString List.AddRow "NumGroups", p.NumGroups.ToString List.AddRow "NumImages", p.NumImages.ToString List.AddRow "NumPaths", p.NumPaths.ToString List.AddRow "NumPatterns", p.NumPatterns.ToString List.AddRow "NumTemplates", p.NumTemplates.ToString List.AddRow "NumTextRecords", p.NumTextRecords.ToString List.AddRow "TabOrder", p.TabOrder.ToString List.AddFolder "Annots", p.Annots List.AddFolder "Actions", p.Actions End Sub
Sub AddDynaPDFParserContentPattern(p as DynaPDFParserContentPatternMBS) List.AddFolder "CSObj", p.CSObj List.AddFolder "BBox", p.BBox List.AddRow "TilingType", p.TilingType.ToString List.AddRow "CS", p.CS.ToString List.AddRow "StepX", p.StepX.ToString List.AddRow "StepY", p.StepY.ToString List.AddRow "Flags", p.Flags.ToString List.AddRow "PatternType", p.PatternType.ToString List.AddRow "NumComponents", p.NumComponents.ToString List.AddRow "Name", p.Name List.AddFolder "ExtGState", p.ExtGState List.AddRow "ElemsCount", p.ElemsCount.ToString List.AddFolder "Elems", p.Elems List.AddRow "Matrix", StringFromArray(p.Matrix) List.AddFolder "Color", p.Color End Sub
Sub AddDynaPDFParserContentShowText(p as DynaPDFParserContentShowTextMBS) List.AddRow "Index", p.Index.ToString List.AddRow "FontSize", p.FontSize.ToString List.AddRow "Width", p.Width.ToString List.AddRow "Visible", p.Visible.ToString List.AddFolder "Font", p.Font List.AddFolder "FontInfo", p.FontInfo List.AddFolder "Ext", p.Ext List.AddRow "Matrix", StringFromArray(p.Matrix) List.AddFolder "TextNodes", p.TextNodes End Sub
Sub AddDynaPDFParserContentShowTextExt(p As DynaPDFParserContentShowTextExtMBS) List.AddFolder "FillColor", p.FillColor List.AddFolder "StrokeColor", p.StrokeColor List.AddFolder "BBox", p.BBox List.AddRow "CharSpacing", p.CharSpacing.ToString List.AddRow "LineWidth", p.LineWidth.ToString List.AddRow "PosX", p.PosX.ToString List.AddRow "PosY", p.PosY.ToString List.AddRow "SpaceWidthT", p.SpaceWidthT.ToString List.AddRow "SpaceWidthU", p.SpaceWidthU.ToString List.AddRow "TextScale", p.TextScale.ToString List.AddRow "WordSpacing", p.WordSpacing.ToString List.AddRow "TextDrawMode", p.TextDrawMode.ToString List.AddFolder "DeviceSpace", p.DeviceSpace List.AddFolder "PageSpace", p.PageSpace End Sub
Sub AddDynaPDFParserContentTextNode(p as DynaPDFParserContentTextNodeMBS) List.AddFolder "BBox", p.BBox List.AddRow "Text", p.Text List.AddRow "Length", p.Length.ToString List.AddRow "Advance", p.Advance.ToString List.AddRow "Width", p.Width.ToString List.AddRow "UniText", p.UniText List.AddRow "UniTextLength", p.UniTextLength.ToString List.AddFolder "Outlines", p.Outlines List.AddRow "Widths", StringFromArray(p.Widths) End Sub
Sub Constructor(file as FolderItem) // Calling the overridden superclass constructor. Super.Constructor Var pdf As New DynaPDFMBS // load CharacterMaps if you want to correctly process asian fonts Var CMapFolder As FolderItem = GetFolderItem("CMap") if CMapFolder.Exists then Call pdf.SetCMapDir(CMapFolder, pdf.klcmRecursive) end If Call pdf.SetImportFlags(pdf.kifImportAll Or pdf.kifImportAsPage) call pdf.CreateNewPDF(nil) Var oe As Integer = pdf.OpenImportFile(file) Var ie As Integer = pdf.ImportPDFFile(1) Var pc As Integer = pdf.GetPageCount For i As Integer = 1 To pc Var parser As New DynaPDFParserMBS(pdf) If parser.ParsePage(i, parser.kcpfEnableTextSelection) Then List.AddFolder "Page "+i.ToString, parser end if Next End Sub
Function StringFromArray(values as DynaPDFMatrixMBS) As String If values = Nil Then return "nil" return values.StringValue End Function
Function StringFromArray(values() as single) As String If values = Nil Then return "nil" Var texts() As String Var u As Integer = values.LastIndex Var l As Integer = u If l > 10 Then l = 10 End If For i As Integer = 0 To l texts.add values(i).ToString Next var r as string = String.FromArray(texts, ", ") If u > 10 Then r = r + "..." end if return r End Function
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileExpandall = "Expand all"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
MenuItem WindowMenu = "Window"
MenuItem HelpMenu = "&Help"
End MenuBar
Sign
End Sign
FileTypeGroup1
Filetype Pdf
End FileTypeGroup1
Module Module1
Sub AddFolder(extends list as DesktopListBox, Name as string, data as Variant) If data = Nil then list.AddRow name, "nil" else list.AddExpandableRow name list.RowTagAt(list.LastAddedRowIndex) = data If Keyboard.AsyncOptionKey Then list.RowExpandedAt(list.LastAddedRowIndex) = true end if End If End Sub
End Module
End Project

Download this example: Show PDF Content.zip

The items on this page are in the following plugins: MBS DynaPDF Plugin.


The biggest plugin in space...