A sample that shows how to use PreventTextCopy
in UWP SDK. We can use this property in XAML as well as C# before loading the document.
There are two ways you can use the PreventTextCopy
property:
-
In code behind Run the application, select some text, and copy it. Try to paste it in the text box at the bottom of the app. You should not be able to paste text from PDF except text annotations.
-
In XAML Uncomment line 19
<pspdfkit:PdfView x:Name="PdfView" PdfUriSource="ms-appx:///Assets/demo.pdf" PreventTextCopy="True"/>
in MainPage.xaml and Comment out line 21<pspdfkit:PdfView x:Name="PdfView" InitializationCompletedHandler="PdfViewOnInitializationCompletedHandler"/>
in MainPage.xamlRun the application, select some text, and copy it. Try to paste it in the text box at the bottom of the app. You should not be able to paste text from PDF except text annotations.