DynaPDF Parser for Xojo
With MBS Xojo DynaPDF Plugin 24.0 we include the DynaPDFParserMBS class. This class provides a top-level interface on the parser in DynaPDF. You can do various operation using this class:
- Parse a page
- Find text on the page.
- Extract text on the page
- Delete text within a rectangle.
- Query coordinates for found text.
- Replace found text with new text.
- Set alternative font for new text.
- Finally write changes back to page.
The combination of these allows for a lot of things. Like finding text on a page and replacing it with new text for a little PDF editor. Or to find text and then:
- Draw rectangles around the found text to show it.
- Put highlight annotations on the text.
- Find website names or keywords and put WebLink annotations on them.
- Use DeleteText function to remove the text from the PDF.
- Find each character and then know the coordinates of every letter.
The possibilities from the handful of functions is enormous. Let's take a look on sample code:
This does a search and replace while looping over all pages. Instead of doing the replace, we could of course query the coordinates on the page for later using the SelBBox property. Then after we found all the positions, we can call EditPage to make changes and for example draw rectangles into the found places. Or add annotations.
Please try the new functions and let us know.