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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Zoom not working

Thread ID:

Created:

Updated:

Platform:

Replies:

145684 Jul 3,2019 02:06 PM UTC May 11,2020 11:38 AM UTC Xamarin.Forms 3
loading
Tags: PdfViewer
Joshua Stelten
Asked On July 3, 2019 02:06 PM UTC

Hello,

I'm trying to implement the PDF viewer on the Xamarin platform. But for some reason it will not pinch zoom the PDF once it is loaded. I have a test project where it does actually zoom correctly, but for this project it won't. The only difference is that in my current project gets it's files from an api instead of the files being embedded into the application itself. Could this cause the viewer not to zoom properly?

Here is my code:

Xaml:
 <ContentPage.Content>
        <StackLayout>
            <syncfusion:SfPdfViewer  x:Name="pdfViewerControl" InputFileStream="{Binding PdfDocumentStream}" Toolbar = "{StaticResource ToolbarSettings}"/>
        </StackLayout>
    </ContentPage.Content>

Xaml.cs(code behind):

 public PdfViewerPage(Sheet _sheet)
        {
            InitializeComponent();
            BindingContext = new PdfViewerViewModel(Navigation, _sheet);
            loginService = new LoginService(Navigation);
            PdfViewerResourceManager.Manager = new ResourceManager("GettingStarted.Resources.Syncfusion.SfPdfViewer.XForms", GetType().GetTypeInfo().Assembly);
        }


ViewModel:
 public Stream PdfDocumentStream
        {
            get { return pdfDocumentStream; }
            set
            {
                //Check the value whether it is the same as the currently loaded stream
                if (value != pdfDocumentStream)
                {
                    pdfDocumentStream = value;
                    OnPropertyChanged();
                }
            }
        }

async void RefreshPdf()
        {
            try
            {
                var bytes = Convert.FromBase64String(await pdfViewerService.GetPdf(sheet.Id));
                PdfDocumentStream = new MemoryStream(bytes);
            }
            catch(Exception e)
            {

            }
        }


As you can see the Api returns the file as a base64string. I'm converting it back into a stream so it can be loaded in the viewer. It gets displayed correctly so i don't suspect the file is being corrupt or anything(other files load fine too but no zoom).

If anyone has a solution that would be great!

Using version: 17.1.0.53


Jhansi Priya Ramesh [Syncfusion]
Replied On July 5, 2019 05:09 AM UTC

Hi Joshua, 
 
Greetings from Syncfusion. 
When PDFViewer is placed inside the Stacklayout, We need to set the VerticalOptions and HorizontalOptions property of the PDF Viewer control to “FillAndExpand”.  
Please find the code snippet below, 
<ContentPage.Content> 
        <StackLayout> 
            <syncfusion:SfPdfViewer  x:Name="pdfViewerControl" InputFileStream="{Binding PdfDocumentStream}" Toolbar = "{StaticResource ToolbarSettings}" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"/> 
        </StackLayout> 
    </ContentPage.Content> 
 
 
However, once the document is loaded zoom will work only after scrolling which is a defect from our side. We are currently working on this issue and the fix for this will be included in our Essential Studio Volume 2 Main Release which will be available by Mid of July 2019. 
 
Regards, 
Jhansi 
 
 


Mik
Replied On May 8, 2020 10:17 AM UTC

Hi Joshua, 
 
Greetings from Syncfusion. 
When PDFViewer is placed inside the Stacklayout, We need to set the VerticalOptions and HorizontalOptions property of the PDF Viewer control to “FillAndExpand”.  
Please find the code snippet below, 
<ContentPage.Content> 
        <StackLayout> 
            <syncfusion:SfPdfViewer  x:Name="pdfViewerControl" InputFileStream="{Binding PdfDocumentStream}" Toolbar = "{StaticResource ToolbarSettings}" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"/> 
        </StackLayout> 
    </ContentPage.Content> 
 
 
However, once the document is loaded zoom will work only after scrolling which is a defect from our side. We are currently working on this issue and the fix for this will be included in our Essential Studio Volume 2 Main Release which will be available by Mid of July 2019. 
 
Regards, 
Jhansi 
 
 


Having same issue on iOS with Syncfusion 17.0.4.39
the Zoom in Android works instead iOS 

Ashokkumar Viswanathan [Syncfusion]
Replied On May 11, 2020 11:38 AM UTC

Hi Joshua, 
 
We were unable to reproduce the issue, “Zoom operation will work only after scrolling the PDF pages in iOS platform” in the product version v17.4.0.39. We have created a simple sample to replicate the issue in our side. 
 
Please find the sample in the below link, 
 
Kindly share the following details to analyze more on this issue and assist you with the better solution   
  • Simple sample/ modify the above sample to reproduce the issue. 
  • PDF document with which you have reproduced. 
  • Xamarin.Forms version.
  • Device specification.
  • Replication procedure to reproduce the issue. 
 
Regard, 
Ashok Kumar Viswanathan. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

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
Live Chat Icon