Platforms to show: All Mac Windows Linux Cross-Platform

DynaPDFParserMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class DynaPDF MBS DynaPDF Plugin 24.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The class for the DynaPDF Parser.
Example
Var pdf As New MyDynapdfMBS
... load some PDF

Var FindText As String = "PDF"
Var ReplaceText As String = "Test"

Var count As Integer = pdf.GetPageCount
Var Parser As New DynaPDFParserMBS(pdf)
Var area As DynaPDFRectMBS = Nil // whole page
Var SearchType As Integer = DynaPDFParserMBS.kstCaseInSensitive
Var ContentParsingFlags As Integer = DynaPDFParserMBS.kcpfEnableTextSelection

For i As Integer = 1 To count

Var needWrite As Boolean

If parser.ParsePage(i, ContentParsingFlags) Then

Var found As Boolean = Parser.FindText(area, SearchType, FindText)
While found
If Parser.ReplaceSelText(ReplaceText) Then
needWrite = True
End If

found = Parser.FindText(area, SearchType, FindText, True)
Wend

If needWrite Then
Call Parser.WriteToPage
End If
End If
next

Allows you to do Find and Replace, text extraction and deletion of text.

Content Parser Flags

Constant Value Description
kcpfCalcDeviceColors 32 Compute device colors of all colors which are set in the content streams.
kcpfComputeBBox 1 Compute bounding boxes of all objects.
kcpfDefault 0 Nothing special to do.
kcpfEnableTextSelection &h00000100 This flag is required to enable text selection and text extraction.
kcpfFlattenLayers 2 Flatten layers.
kcpfFullRecursive 8 Parse all objects recursively.
kcpfInitMatrix &h00000200 Use an initial matrix, which must be set with InitMatrix property.
kcpfNoInlineTemplate 16 Do not resolve templates with a reference count of 1.
kcpfSkipClipPaths &h00000400 Useful for debugging purposes.
kcpfSkipImages &h00000800 Ignore all images. This flag is useful for text extraction.
kcpfSkipInvisibleObjects 4 Ignore invisible objects.
kcpfSkipShadings &h00001000 Useful for debugging purposes.
kcpfSkipText &h00002000 Useful for debugging purposes.
kcpfSkipVector &h00004000 Useful for debugging purposes. Exclude vector graphics with exception of clipping paths.

Search Types

Constant Value Description
kstCaseInSensitive 2 Case insensitive search
kstDefault 0 Case sensitive search
kstMatchAlways 4 Return on every single character. Text is ignored when this flag is set.
kstSearchAsIs 8 Disable sorting on the x-axis.
kstWholeWord 1 Only whole words
Example

Text Extraction Flags

Constant Value Description
ktefDefault 0 Create text lines in the original order.
ktefDeleteOverlappingText 4 Delete duplicate text records on same position.
ktefNoHeuristic 8 If set, text is sorted on the x-axis as specified. If absent, a heuristic is used to determine whether it is might be better to leave a line unsorted.
ktefSortTextX 1 Sort text records in x-direction.
ktefSortTextXY 3 Sort text records in x and y-direction.
ktefSortTextY 2 Sort text records in y-direction.

This class has no sub classes.

Some examples using this class:

Blog Entries

Release notes


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


DynaPDFParseInterfaceMBS   -   DynaPDFPointDataDictionaryMBS


The biggest plugin in space...