We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use PdfViewer in Xamarin.Forms inside StackLayout?

Platform: Xamarin.Forms |
Control: PdfViewer

When Xamarin PDF viewer is added to a StackLayout in Xamarin.Forms, it works as expected in Android platform. But in iOS and UWP, the PDF viewer is not visible. This is true regardless of whether the PDF viewer is an immediate child of StackLayout or the StackLayout is at a higher level of parent hierarchy. This is due to the default behavior of StackLayout that it does not show the entire contents of its child if the child’s size is not defined.


To make the PdfViewer visible in both iOS and UWP, the HorizontalOptions (if the orientation of the StackLayout is horizontal) or VerticalOptions (if the orientation of the StackLayout is vertical) of the immediate child of the StackLayout must be set to “FillAndExpand”.


If the PDF viewer is an immediate child to a StackLayout, set the HorizontalOptions or VerticalOptions of the PDF viewer to “FillAndExpand”. For example, the vertical orientation is used in the following code.



<StackLayout Orientation="Vertical">
   <syncfusion:SfPdfViewer VerticalOptions="FillAndExpand" />


Sample link:



If the PDF viewer is at lower level in the child hierarchy of a StackLayout, set the VerticalOptions or HorizontalOptions of the immediate child of the StackLayout to “FillAndExpand”. For example, horizontal orientation is used in the following code.



<StackLayout Orientation="Horizontal">
        <Frame HorizontalOptions="FillAndExpand">
                    <syncfusion:SfPdfViewer />


Sample link:


Xamarin PDF Viewer Xaml horizontal orientation

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile