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.
Unfortunately, activation email could not send to your email. Please try again.

How to use PdfViewer inside StackLayout?

When 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.

 

XAML

 

Sample link:

http://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample-1519498600

 

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.

 

XAML

 

Sample link:

http://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample1-1997919178

Article ID: Published Date: Last Revised Date: Platform: Control:
8784 05/29/2018 05/29/2018 Xamarin.Forms PdfViewer
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.