Layout PDFViewer Question!

Hello... In the XAML snippet on bellow there are a StackLayout with a PDFViewer and a Grid controls.

Both are binding to the ViewModel properties WaitingSignature and EmptyDocument with IsVisible property.

When I load the PDF document I update the values of the properties to EmptyDocument = false and WaitingSignature = true.

So, grid is hidden and PDFViewer is showned but the PDF content is not displayed, but I can see the page number of PDFViewer.

I guess that the layout is problem.

XAML:

    <StackLayout
                HorizontalOptions="FillAndExpand"
                VerticalOptions="FillAndExpand"
        >
        <pdfviewer:SfPdfViewer
                x:Name="pdfViewerControl"
                IsToolbarVisible="False"
                BookmarkPaneVisible="False"
                BookmarkNavigationEnabled="False"
                PageViewMode="Continuous"
                InputFileStream="{Binding PDFStream}"
                ShowPageNumber="True"
                IsVisible="{Binding WaitingSignature}"
                HorizontalOptions="FillAndExpand"
                VerticalOptions="FillAndExpand"
                />
        <Grid
                HorizontalOptions="FillAndExpand"
                VerticalOptions="FillAndExpand"
                IsVisible="{Binding EmptyDocument}"
                >
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Image
                    Grid.Row="0"
                    x:Name="imagePulse"
                    HorizontalOptions="FillAndExpand"
                    VerticalOptions="FillAndExpand"
                    Source="computer_icon.png"
                    IsVisible="{Binding EmptyDocument}"
                />
        </Grid>
    </StackLayout>


Any sugestions?




5 Replies 1 reply marked as answer

AV Ashokkumar Viswanathan Syncfusion Team August 26, 2020 08:27 AM UTC

Hi Roosevelt, 
 
Thank you for contacting Syncfusion support, 
 
We were unable to reproduce the reported issue, “PDF content is  not displayed  in our end. 
 
Please find the sample in the below link,   
 
Kindly share the below requested 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. 
·       SfPdfViewer version. 
·       Xamarin Forms version. 
·       Replication procedure/video to reproduce the issue.   
 
Regards, 
Ashok Kumar Viswanathan. 



RO Roosevelt August 26, 2020 01:00 PM UTC

Hi Ashokkumar!

Thank you by you answer!

I changed a little the project and I can reproduce the issue.

Please, change the PDFViewerViewModel constructor to snippet below and the issue will be reproduced:

        public PdfViewerViewModel()
        {
            //Accessing the PDF document that is added as embedded resource as stream.

            Task.Run(() => {
                Task.Delay(10000).Wait();
                m_pdfDocumentStream = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("GettingStarted.Assets.GIS Succinctly.pdf");
                EmptyDocument = false;
                WaitingSignature = true;
            });

            m_pdfDocumentStream = null;
            EmptyDocument = true;
            WaitingSignature = false;
        }

Thank's




AV Ashokkumar Viswanathan Syncfusion Team August 27, 2020 08:48 AM UTC

Hi Roosevelt, 
 
Thank you for contacting Syncfusion support, 
 
We were able to reproduce the issue, “PDF content is  not displayed”. Currently, we are validating the issue and we will update the further details on August 31st 2020. 
 
Regards, 
Ashok Kumar Viswanathan.  



AV Ashokkumar Viswanathan Syncfusion Team August 31, 2020 05:08 PM UTC

Hi Roosevelt,  
  
Sorry for the inconvenience caused, 
  
We are still validating the issue, “PDF content is  not displayed” due to its complexity and we will update the further details on September 2nd ,2020 without any further delay. 
  
Regards,  
Ashok Kumar Viswanathan.   



AV Ashokkumar Viswanathan Syncfusion Team September 2, 2020 03:41 PM UTC

Hi Roosevelt 
 
Thank you for your patience, 
 
While analyzing the issue, “PDF content is  not displayed” we have found that this issue is not related to the PDFViewer control. This issue occurs due to the sample level changes. However setting WaitingSignature property before the setting the PdfDocumentStream to the PDFViewer control will resolve the issue in your end. 
 
Please find the code snippet below, 
public PdfViewerViewModel() 
        { 
            //Accessing the PDF document that is added as embedded resource as stream. 
            Task.Run(() => { 
                Task.Delay(10000).Wait(); 
                WaitingSignature = true; 
                PdfDocumentStream = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("GettingStarted.Assets.GIS Succinctly.pdf"); 
                EmptyDocument = false; 
                WaitingSignature = true; 
            }); 
 
            m_pdfDocumentStream = null; 
            EmptyDocument = true; 
            WaitingSignature = false; 
        } 
 
Please find the modified sample for your reference 
 
Note : And also set the vertical and horizontal options to the Grid layout which is placed inside the Stack layout. 
 
Regards, 
Ashok Kumar Viswanathan. 


Marked as answer
Loader.
Up arrow icon