Selecting text in our iOS viewer
Text selection is controlled via TextSelectionView
, which is part of every PDFPageView
, and it can be accessed using the selectionView
property.
PDFViewControllerDelegate
has delegate methods that allow you to selectively block text selection (pdfViewController(_:shouldSelectText:with:at:on:)
) and to be notified whenever a text has been selected (pdfViewController(_:didSelectText:with:at:on:)
).
Another flexible option is the allTextInteractions
interaction component.
Text selection can also be disabled via the isTextSelectionEnabled
switch in the configuration object.
Text can be programmatically selected via setting selectedGlyphs
or selectedImage
for image selection. Set these properties to nil
to clear the current selection.