Platforms to show: All Mac Windows Linux Cross-Platform

/DynaPDF/Extract Texts

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/Extract Texts

This example is the version from Fri, 4th Feb 2021.

Project "Extract Texts.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub NewDocument() Dim f As FolderItem = GetOpenFolderItem("") If f <> Nil Then OpenDocument f End If End EventHandler
EventHandler Sub OpenDocument(item As FolderItem) Dim w As New MainWindow w.Load item End EventHandler
End Class
Class MainWindow Inherits Window
Control PageSlider Inherits Slider
ControlInstance PageSlider Inherits Slider
EventHandler Sub ValueChanged() LoadPage End EventHandler
End Control
Control Output Inherits TextArea
ControlInstance Output Inherits TextArea
End Control
Sub Load(file as FolderItem) pdf = New DynaPDFMBS pdf.SetLicenseKey "Lite" // For this example you can use a Lite, Pro or Enterprise License Call pdf.CreateNewPDF(Nil) // we don't need all, so only content please. dim ImportFlags as Integer = BitwiseOr(pdf.kifContentOnly, pdf.kifImportAsPage) Call pdf.SetImportFlags(ImportFlags) If pdf.OpenImportFile(file, pdf.kptOpen, "")<>0 Then MsgBox "error loading pdf" Quit End If // import all pages Call pdf.ImportPDFFile(1) // configure slider for all pages PageSlider.Minimum = 1 PageSlider.Maximum = pdf.GetPageCount PageSlider.Value = 1 // triggers LoadPage End Sub
Sub LoadPage() Dim page As Integer = PageSlider.Value System.DebugLog CurrentMethodName+": "+Str(page) // default flags Dim flags As Integer = pdf.ktefDefault // extract text from that page Dim Text As String Dim b As Boolean = pdf.ExtractText(page, flags, Text) // standardize line endings Text = ReplaceLineEndings(Text, EndOfLine) output.Text = Text End Sub
Property PDF As DynaPDFMBS
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
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"
End MenuBar
End Project

See also:

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

The biggest plugin in space...