locked
How to display pdf in browser from database using Xamarin and SQL Server RRS feed

  • Question

  • I have a listview in Xamarin form, which you can see in the screenshot here:

    https://i.stack.imgur.com/1gTv6.png

    and this is my database structure

    https://i.stack.imgur.com/8GHFc.png

    as you can see in database i have file content which is in binary format and these binary data are pdf files, i need to display these pdf in browser.

    In my listview, I am retrieving data with button, what i want is  when the user clicks on button, a PDF file should open in browser from the database based on id.

    This is my xaml code

        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <StackLayout Orientation="Vertical" Padding="12,6">
                        <Label Text="{Binding ReportName}" 
                               FontSize="24" 
                               Style="{DynamicResource ListItemTextStyle}" />
                        <Label Text="{Binding Date}"  
                               FontSize="18" 
                               Opacity="0.6"
                               Style="{DynamicResource ListItemDetailTextStyle}"/>
                          <Button Clicked="ShowPDF" Text="View" CommandParameter="{Binding FileContent}"></Button>
                    </StackLayout>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>

      [1]: https://i.stack.imgur.com/1gTv6.png
      [2]: https://i.stack.imgur.com/8GHFc.png


      

        protected void ShowPDF(object sender, EventArgs args)
                {
        
                    Button button = (Button)sender;
        
                    string path = button.CommandParameter.ToString();
        
              
        
                    Navigation.PushAsync(new PDFView(path));
                }
    • Moved by CoolDadTx Monday, April 16, 2018 2:25 PM Not C# related
    Monday, April 16, 2018 10:33 AM

All replies

  • These forums are for C#-specific questions only. Please post questions related to UI technologies like Xamarin in the appropriate forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Monday, April 16, 2018 2:25 PM