SfPdfViewer does not work for a project Xamarin.Forms iOS

Hello

I'm using the PDF viewer for a Xamarin.Forms project on Android and iOS.

The PDF display works great on Android, but on iOS, whether on an emulator, an iPad or an iPhone, the display does not work and the page remains blank.

Of course, I instantiate the SfPdfDocumentViewRenderer class in the AppDelegate file. I even try the static Init method of the SfPdfDocumentViewRenderer class ... but nothing works!

Did I forget to initialize something?

Best Regards

M. BINET Julien

------------------------------------------------------------------------------------------------------------
The nuggets packages:
Syncfusion.Xamarin.SfPdfViewer 15.4.0.20
Xamarin.Forms 2.4.0.91020

My environment:
=== Visual Studio Community 2017 for Mac ===

Version 7.3.2 (build 12)
Installation UUID: c92dca29-4e75-4725-9978-d4057660d9f4
Runtime:
Mono 5.4.1.7 (2017-06/e66d9abbb27) (64-bit)
GTK+ 2.24.23 (Raleigh theme)

Package version: 504010007

=== NuGet ===

Version: 4.3.1.4445

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
2.0.4
2.0.3
2.0.0
SDK: /usr/local/share/dotnet/sdk/2.1.3/Sdks
SDK Versions:
2.1.3
2.0.3
2.0.0
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.6.0
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 9.2 (13772)
Build 9C40b

=== Xamarin.iOS ===

Version: 11.6.1.2 (Visual Studio Community)
Hash: 6857dfcc
Branch: xcode9.2
Build date: 2017-12-04 21:20:41-0500

=== Xamarin.Android ===

Version: 8.1.0.25 (Visual Studio Community)
Android SDK: /usr/local/Caskroom/android-platform-tools/27.0.1
Supported Android versions:
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)
7.0 (API level 24)
7.1 (API level 25)
8.0 (API level 26)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 27.0.1
SDK Build Tools Version: 27.0.3

Java SDK: /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home
java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Inspector ===

Version: 1.3.2
Hash: 461f09a
Branch: 1.3-release
Build date: Tue, 03 Oct 2017 18:26:57 GMT
Client compatibility: 1

=== Xamarin.Mac ===

Version: 4.0.0.214 (Visual Studio Community)

=== Build Information ===

Release ID: 703020012
Git revision: 7d0c9d7ad46b125cf4b7bbf9532c0531b6433ce6
Build date: 2017-12-12 14:03:18-05
Xamarin addins: 6dddaa49fbecb2695fcdcd6b712eb269e288518c
Build lane: monodevelop-lion-d15-5

=== Operating System ===

Mac OS X 10.13.2
Darwin 17.3.0 Darwin Kernel Version 17.3.0
    Thu Nov  9 18:09:22 PST 2017
    root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

NuGet Package Explorer 0.2
NuGet Package Management Extensions 0.12.6
Paket 0.4
PowerShell 0.3
xUnit.NET 2 testing framework support 0.7.5
Internet of Things (IoT) development (Preview) 7.1


3 Replies

KE Kathiravan Elangovan Syncfusion Team January 10, 2018 06:36 AM UTC

Hi Julien, 

Thanks for contacting syncfusion. 

We have created a simple sample to load a PDF document in PDF Viewer Xamarin Forms iOS. Please refer the sample from the below link, 

Please refer the below UG documentation link for more information about to display a PDF document in PDF Viewer Xamarin Forms.  

Please modify your sample with respect to the attached sample and details provided in the UG documentation link. Still if you are facing any difficulties in your end, Please share the sample in which you are facing the issues to display a PDF document in PDF Viewer Xamarin Forms iOS. 

Please let us know if you have any concerns.  

Regards, 
Kathiravan E


JU Julien January 10, 2018 09:06 AM UTC

Hello,

Thank you for your answer !

Following your example, I was able to solve my problem on iOS :)

The problem was that the SfPdfViewer control was in a StackLayout container, replacing it with a Grid container, the problem was solved.


KE Kathiravan Elangovan Syncfusion Team January 11, 2018 01:28 PM UTC

Hi Julien, 

Thanks for your update. 

If you need to use the PDF Viewer inside a StackLayout in Xamarin Forms iOS, We need to set the VerticalOptions and HorizontalOptions property of the PDF Viewer control to “FillAndExpand”. 

Please refer the below code snippet to use the PDF Viewer inside the StackLayout in Xamarin Forms iOS. 
<StackLayout x:Name="pdfViewGrid" > 
        <syncfusion:SfPdfViewer x:Name="pdfViewerControl" InputFileStream="{Binding PdfDocumentStream}" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"/> 
</StackLayout> 

We have created a simple sample by using the above code snippet and please find the sample from the below link. 

Please refer the output screenshot from the below link 

Please let us know if you have any concerns. 

Regards, 
Kathiravan E

Loader.
Up arrow icon