Example: /DynaPDF/Show Annotations

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/DynaPDF/Show Annotations


Required plugins for this example: MBS DynaPDF Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /DynaPDF/Show Annotations

This example is the version from Fri, 6th Nov 2014.

Project "Show Annotations.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub NewDocument() dim f as FolderItem = GetOpenFolderItem(FileTypes1.Pdf) if f<>Nil then OpenDocument f end if End EventHandler
EventHandler Sub OpenDocument(item As FolderItem) dim w as new MainWindow w.run item w.show End EventHandler
End Class
Class MainWindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Sub run(file as FolderItem) Title = file.DisplayName dim p as new MyDynapdfMBS p.SetLicenseKey "Lite" // For this example you can use Lite, Pro or Enterprise License call p.CreateNewPDF(nil) // Skip anything that is not required call p.SetImportFlags p.kifImportAll+p.kifImportAsPage // From which PDF file do you want to extract the images? call p.OpenImportFile(file, p.kptOpen, "") // import pages call p.ImportPDFFile(1, 1.0, 1.0) call p.CloseImportFile // lookup all links dim u as integer = p.GetAnnotCount-1 Title = str(p.GetAnnotCount)+" annotations" for i as integer = 0 to u dim b as DynaPDFAnnotationExMBS = p.GetAnnotEx(i) dim bbox as DynaPDFRectMBS = b.BBox List.AddRow "" Select case b.Type case p.kat3D List.Cell(List.LastIndex,0) = "3D" case p.katCaret List.Cell(List.LastIndex,0) = "Caret" case p.katCircle List.Cell(List.LastIndex,0) = "Circle" case p.katFileAttach List.Cell(List.LastIndex,0) = "FileAttach" case p.katFileLink List.Cell(List.LastIndex,0) = "FileLink" case p.katFreeText List.Cell(List.LastIndex,0) = "FreeText" case p.katHighlight List.Cell(List.LastIndex,0) = "Highlight" case p.katInk List.Cell(List.LastIndex,0) = "Ink" case p.katLine List.Cell(List.LastIndex,0) = "Line" case p.katMovieAnnot List.Cell(List.LastIndex,0) = "MovieAnnot" case p.katPageLink List.Cell(List.LastIndex,0) = "PageLink" case p.katPolygon List.Cell(List.LastIndex,0) = "Polygon" case p.katPolyLine List.Cell(List.LastIndex,0) = "PolyLine" case p.katPopUp List.Cell(List.LastIndex,0) = "PopUp" case p.katPrinterMark List.Cell(List.LastIndex,0) = "PrinterMark" case p.katProjection List.Cell(List.LastIndex,0) = "Projection" case p.katRedact List.Cell(List.LastIndex,0) = "Redact" case p.katRichMedia List.Cell(List.LastIndex,0) = "RichMedia" case p.katScreen List.Cell(List.LastIndex,0) = "Screen" case p.katSoundAnnot List.Cell(List.LastIndex,0) = "SoundAnnot" case p.katSquare List.Cell(List.LastIndex,0) = "Square" case p.katSquiggly List.Cell(List.LastIndex,0) = "Squiggly" case p.katStamp List.Cell(List.LastIndex,0) = "Stamp" case p.katStrikeOut List.Cell(List.LastIndex,0) = "StrikeOut" case p.katText List.Cell(List.LastIndex,0) = "Text" case p.katTrapNet List.Cell(List.LastIndex,0) = "TrapNet" case p.katUnderline List.Cell(List.LastIndex,0) = "Underline" case p.katUnknown List.Cell(List.LastIndex,0) = "Unknown" case p.katWatermark List.Cell(List.LastIndex,0) = "Watermark" case p.katWebLink List.Cell(List.LastIndex,0) = "WebLink" case p.katWidget List.Cell(List.LastIndex,0) = "Widget" else List.Cell(List.LastIndex,0) = str(b.Type) end Select list.Cell(List.LastIndex,1) = b.Subtype list.Cell(List.LastIndex,2) = b.name list.Cell(List.LastIndex,3) = b.Content List.Cell(List.LastIndex,4) = Format(BBox.Left,"0")+"/"+Format(BBox.top,"0")+" "+Format(BBox.Right,"0")+"/"+Format(BBox.Bottom,"0") list.Cell(List.LastIndex,5) = b.DestFile list.Cell(List.LastIndex,6) = str(b.DestPage) list.Cell(List.LastIndex,7) = b.Subject list.Cell(List.LastIndex,8) = b.Author list.Cell(List.LastIndex,9) = b.State next End Sub
Property bookmarkChildren As Dictionary
Property bookmarks As Dictionary
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
FileTypes1
Filetype application/pdf
End FileTypes1
Class MyDynaPDFMBS Inherits DynaPDFMBS
EventHandler Function Error(ErrorCode as integer, ErrorMessage as string, ErrorType as integer) As integer // output all messages on the console: System.DebugLog str(ErrorCode)+": "+ErrorMessage // and display dialog: Dim d as New MessageDialog //declare the MessageDialog object Dim b as MessageDialogButton //for handling the result d.icon=MessageDialog.GraphicCaution //display warning icon d.ActionButton.Caption="Continue" d.CancelButton.Visible=True //show the Cancel button // a warning or an error? if BitAnd(ErrorType, me.kE_WARNING) = me.kE_WARNING then // if user decided to ignore, we'll ignore if IgnoreWarnings then Return 0 d.Message="A warning occurred while processing your PDF code." // we add a third button to display all warnings d.AlternateActionButton.Caption = "Ignore warnings" d.AlternateActionButton.Visible = true else d.Message="An error occurred while processing your PDF code." end if d.Explanation = str(ErrorCode)+": "+ErrorMessage b=d.ShowModal //display the dialog Select Case b //determine which button was pressed. Case d.ActionButton Return 0 // ignore Case d.AlternateActionButton IgnoreWarnings = true Return 0 // ignore Case d.CancelButton Return -1 // stop End select End EventHandler
Property IgnoreWarnings As Boolean
End Class
End Project

See also:

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


💬 Ask a question or report a problem