Most of you are well aware of the Essential Studio 2019 Volume 3 release. For this release, the Xamarin.Forms PDF Viewer component has some most anticipated feature updates, which I am going to walk through in this blog.
You can now view PDF files page by page with horizontal navigation support. The single-page view mode offers better readability for e-book readers. You can perform all the operations (including annotations, text search, bookmark navigations, etc.) in single-page view mode like in the continuous mode.
The view mode can be changed using the PageViewMode property of the PDF Viewer. The enum PageViewMode has two values: Continuous and PageByPage. The default value of this property is Continuous. The following code example illustrates how to switch to the page-by-page view mode.
//Enable the Single page view mode pdfViewer.PageViewMode = PageViewMode.PageByPage;
To learn more about switching to single-page view mode and its features, please refer to our documentation for single-page view mode.
You can download the sample for the single page view mode from this GitHub location.
Load encrypted PDF document
PDF Viewer now allows loading and viewing password-protected PDF files by getting the password from the user. The following code example shows how to load an encrypted PDF file.
//Document password string password = "PASSWORD"; //Load the encrypted PDF document pdfViewer.LoadDocument(pdfStream, password)
In the previous code example, pdfStream is a stream instance read from the encrypted PDF and password is the key with which the PDF file is encrypted.
To learn more about loading encrypted documents and handling invalid passwords, please refer to our documentation, Loading password protected PDFs.
You can download the sample for loading encrypted PDF documents from this GitHub location.
Minimum zoom percentage
PDF files loaded in the PDF Viewer can now be minimized to a certain level. This feature offers better readability on high-definition devices, since the document will be magnified to fit to the page width by default.
The following code example will set the minimum zoom percentage of PDF Viewer instance to 10%.
//Set the minimum zoom percentage value to ‘10’ pdfViewer.MinimumZoomPercentage = 10;
To learn more about zoom customization, please refer to our documentation page, Working with magnification.
You can download the sample for minimizing the zoom factor of PDF Viewer to a certain level from this GitHub location.
If you are an existing Syncfusion user, please download the latest version from the License and Downloads page and try the new features for yourself. Also, our NuGet packages are available on NuGet.org. If you aren’t a customer yet, you can try our 30-day free trial to check out these features. Try our other samples from this GitHub location.
If you wish to send us feedback or would like to submit any questions, please feel free to post them in the comments section below, or contact us through our support forum, Direct-Trac, or feedback portal. We are happy to assist you!
If you liked this post, we think you will also enjoy the following: